@SuppressWarnings("deprecation") @Test public void getScoreWithFeaturesCreatesStubPatient() throws ComponentLookupException { String[] features = new String[] { "HP:1", "custom" }; String[] negativeFeatures = new String[] { "HP:2", "custom negative" }; PatientSpecificityService service = this.mocker.getInstance(PatientSpecificityService.class); CapturingMatcher<Patient> patientCapture = new CapturingMatcher<>(); when(service.getScore(Matchers.argThat(patientCapture))).thenReturn(2.5); Assert.assertEquals(2.5, this.mocker.getComponentUnderTest().getScore(features, negativeFeatures), 0.0); Patient patient = patientCapture.getLastValue(); Set<? extends Feature> setFeatures = patient.getFeatures(); boolean hasHP1 = false; boolean hasHP2 = false; for (Feature feature : setFeatures) { switch (feature.getId()) { case "HP:1": hasHP1 = true; Assert.assertTrue(feature.isPresent()); Assert.assertNull(feature.getName()); Assert.assertNull(feature.getNotes()); Assert.assertNull(feature.getType()); Assert.assertNull(feature.getValue()); Assert.assertNull(feature.getMetadata()); Assert.assertNull(feature.getPropertyName()); Assert.assertNull(feature.getCategories()); Assert.assertNull(feature.toJSON()); break; case "HP:2": hasHP2 = true; Assert.assertFalse(feature.isPresent()); break; default: Assert.fail(); } } Assert.assertTrue(hasHP1); Assert.assertTrue(hasHP2); Assert.assertEquals(Patient.CLASS_REFERENCE, patient.getType()); Assert.assertNull(patient.getId()); Assert.assertNull(patient.getExternalId()); Assert.assertNull(patient.getName()); Assert.assertNull(patient.getSecureDocument()); Assert.assertNull(patient.getDocument()); Assert.assertNull(patient.getXDocument()); Assert.assertNull(patient.getDescription()); Assert.assertNull(patient.getDocumentReference()); Assert.assertNull(patient.getReporter()); Assert.assertNull(patient.getDisorders()); Assert.assertNull(patient.getData("")); Assert.assertNull(patient.getData(null)); Assert.assertNull(patient.toJSON()); Assert.assertNull(patient.toJSON(Collections.<String>emptySet())); Assert.assertNull(patient.toJSON(null)); patient.updateFromJSON(null); }
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);  }