You can just do assertEquals(drug1, drug1.getDrugReferenceMaps().iterator().next())