### Question:
CommonCodeSystemsTerminologyService implements IValidationSupport { @Override public CodeValidationResult validateCodeInValueSet(ValidationSupportContext theValidationSupportContext, ConceptValidationOptions theOptions, String theCodeSystem, String theCode, String theDisplay, @Nonnull IBaseResource theValueSet) { String url = getValueSetUrl(theValueSet); return validateCode(theValidationSupportContext, theOptions, theCodeSystem, theCode, theDisplay, url); } CommonCodeSystemsTerminologyService(FhirContext theFhirContext); @Override CodeValidationResult validateCodeInValueSet(ValidationSupportContext theValidationSupportContext, ConceptValidationOptions theOptions, String theCodeSystem, String theCode, String theDisplay, @Nonnull IBaseResource theValueSet); @Override CodeValidationResult validateCode(ValidationSupportContext theValidationSupportContext, ConceptValidationOptions theOptions, String theCodeSystem, String theCode, String theDisplay, String theValueSetUrl); @Nullable CodeValidationResult validateLookupCode(ValidationSupportContext theValidationSupportContext, String theCode, String theSystem); @Override LookupCodeResult lookupCode(ValidationSupportContext theValidationSupportContext, String theSystem, String theCode); @Override IBaseResource fetchCodeSystem(String theSystem); @Override boolean isCodeSystemSupported(ValidationSupportContext theValidationSupportContext, String theSystem); @Override boolean isValueSetSupported(ValidationSupportContext theValidationSupportContext, String theValueSetUrl); @Override FhirContext getFhirContext(); static String getValueSetUrl(@Nonnull IBaseResource theValueSet); static String getCodeSystemUrl(@Nonnull IBaseResource theCodeSystem); static String getValueSetVersion(@Nonnull IBaseResource theValueSet); static final String LANGUAGES_VALUESET_URL; static final String MIMETYPES_VALUESET_URL; static final String MIMETYPES_CODESYSTEM_URL; static final String CURRENCIES_CODESYSTEM_URL; static final String CURRENCIES_VALUESET_URL; static final String COUNTRIES_CODESYSTEM_URL; static final String UCUM_CODESYSTEM_URL; static final String UCUM_VALUESET_URL; }### Answer:
@Test public void testUcum_ValidateCode_Good() { ValueSet vs = new ValueSet(); vs.setUrl("http: IValidationSupport.CodeValidationResult outcome = mySvc.validateCodeInValueSet(new ValidationSupportContext(myCtx.getValidationSupport()), new ConceptValidationOptions(), "http: assertEquals(true, outcome.isOk()); assertEquals("(milligram)", outcome.getDisplay()); }
@Test public void testUcum_ValidateCode_Good_SystemInferred() { ValueSet vs = new ValueSet(); vs.setUrl("http: IValidationSupport.CodeValidationResult outcome = mySvc.validateCodeInValueSet(new ValidationSupportContext(myCtx.getValidationSupport()), new ConceptValidationOptions().setInferSystem(true), null, "mg", null, vs); assertEquals(true, outcome.isOk()); assertEquals("(milligram)", outcome.getDisplay()); }
@Test public void testUcum_ValidateCode_Bad() { ValueSet vs = new ValueSet(); vs.setUrl("http: IValidationSupport.CodeValidationResult outcome = mySvc.validateCodeInValueSet(new ValidationSupportContext(myCtx.getValidationSupport()), new ConceptValidationOptions(), "http: assertNull(outcome); }