@Test public void getScoreWithNullFeaturesDoesntFail() throws ComponentLookupException { String[] features = new String[] { "HP:1" }; String[] negativeFeatures = new String[] { "HP:2" }; PatientSpecificityService service = this.mocker.getInstance(PatientSpecificityService.class); CapturingMatcher<Patient> patientCapture = new CapturingMatcher<>(); when(service.getScore(Matchers.argThat(patientCapture))).thenReturn(2.5); this.mocker.getComponentUnderTest().getScore(features, null); Patient patient = patientCapture.getLastValue(); Assert.assertEquals(1, patient.getFeatures().size()); Assert.assertEquals("HP:1", patient.getFeatures().iterator().next().getId()); Assert.assertTrue(patient.getFeatures().iterator().next().isPresent()); this.mocker.getComponentUnderTest().getScore(null, negativeFeatures); patient = patientCapture.getLastValue(); Assert.assertEquals(1, patient.getFeatures().size()); Assert.assertEquals("HP:2", patient.getFeatures().iterator().next().getId()); Assert.assertFalse(patient.getFeatures().iterator().next().isPresent()); this.mocker.getComponentUnderTest().getScore(null, null); patient = patientCapture.getLastValue(); Assert.assertTrue(patient.getFeatures().isEmpty()); }
public double getScore(Patient patient) { return this.service.getScore(patient); }
PatientSpecificityScriptService implements ScriptService { public double getScore(Patient patient) { return this.service.getScore(patient); } }
PatientSpecificityScriptService implements ScriptService { public double getScore(Patient patient) { return this.service.getScore(patient); }  }
PatientSpecificityScriptService implements ScriptService { public double getScore(Patient patient) { return this.service.getScore(patient); }  double getScore(Patient patient); double getScore(String[] features, String[] negativeFeatures); }
PatientSpecificityScriptService implements ScriptService { public double getScore(Patient patient) { return this.service.getScore(patient); }  double getScore(Patient patient); double getScore(String[] features, String[] negativeFeatures);  }