WidePatientReader { @NotNull @VisibleForTesting static String determineResponse(@NotNull WideResponseData response) { String responseString = Strings.EMPTY; if (response.recistDone()) { if (!response.recistResponse().isEmpty()) { responseString = "(" + response.timePoint() + ") " + response.recistResponse(); } } else if (!response.noRecistResponse().isEmpty()) { responseString = "(" + response.timePoint() + ") " + response.noRecistResponse(); if (!response.noRecistReasonStopTreatment().isEmpty()) { if (response.noRecistReasonStopTreatmentOther().isEmpty()) { responseString = responseString + " (" + response.noRecistReasonStopTreatment() + ")"; } else { responseString = responseString + " (" + response.noRecistReasonStopTreatmentOther() + ")"; } } } return responseString; } WidePatientReader(@NotNull final WideEcrfModel wideEcrfModel, @NotNull final TumorLocationCurator tumorLocationCurator,
            @NotNull final TreatmentCurator treatmentCurator); @NotNull Patient read(@NotNull String patientIdentifier, @Nullable String limsPrimaryTumorLocation,
            @NotNull List<SampleData> sequencedSamples); @NotNull static List<DrugData> preAvlTreatmentDrugList(@NotNull WidePreAvlTreatmentData preAvlTreatment,
            @NotNull TreatmentCurator treatmentCurator);  }
@Test public void canDetermineResponse() { WideResponseData responseFollowRecist = baseBuilder().timePoint(1).recistDone(true).recistResponse("PD").build(); assertEquals("(1) PD", WidePatientReader.determineResponse(responseFollowRecist)); WideResponseData responseNotRecist = baseBuilder().timePoint(2) .recistDone(false) .noRecistResponse("stop treatment") .noRecistReasonStopTreatment("death") .build(); assertEquals("(2) stop treatment (death)", WidePatientReader.determineResponse(responseNotRecist)); WideResponseData responseNotRecistOther = baseBuilder().timePoint(3) .recistDone(false) .noRecistResponse("stop treatment") .noRecistReasonStopTreatment("other, please specify") .noRecistReasonStopTreatmentOther("don't like it anymore") .build(); assertEquals("(3) stop treatment (don't like it anymore)", WidePatientReader.determineResponse(responseNotRecistOther)); WideResponseData responseNotFilledIn = baseBuilder().timePoint(1).recistDone(true).build(); assertTrue(WidePatientReader.determineResponse(responseNotFilledIn).isEmpty()); }