### Question:
Allergen { public boolean isSameAllergen(Allergen allergen) { if (isCoded()) { return allergen.getCodedAllergen() != null && codedAllergen.equals(allergen.getCodedAllergen()); } else { return nonCodedAllergen != null && allergen.getNonCodedAllergen() != null && nonCodedAllergen .equalsIgnoreCase(allergen.getNonCodedAllergen()); } } Allergen();  Allergen(AllergenType allergenType, Concept codedAllergen, String nonCodedAllergen); AllergenType getAllergenType(); void setAllergenType(AllergenType allergenType); Concept getCodedAllergen(); static void setOtherNonCodedConceptUuid(String otherNonCodedConceptUuid); static String getOtherNonCodedConceptUuid(); void setCodedAllergen(Concept codedAllergen); String getNonCodedAllergen(); void setNonCodedAllergen(String nonCodedAllergen); boolean isCoded(); @Override String toString(); boolean isSameAllergen(Allergen allergen);  }### Answer:
@Test public void isSameAllergen_shouldReturnTrueForSameCodedAllergen() { Concept c = new Concept(); Assert.assertTrue(new Allergen(null, c, null).isSameAllergen(new Allergen(null, c, null))); }
@Test public void isSameAllergen_shouldReturnFalseForDifferentCodedAllergen() { Assert.assertFalse(new Allergen(null, new Concept(1), null).isSameAllergen(new Allergen(null, new Concept(2), null))); }