### Question:
Profiles { public int deleteProfile(Profile profile, ACS acs, boolean cascade) throws SQLException { if (!acs.getUser().isProfileAdmin(profile.getUnittype().getId(), profile.getId())) { throw new IllegalArgumentException("Not allowed action for this user"); } if (cascade) { ProfileParameters pParams = profile.getProfileParameters(); ProfileParameter[] pParamsArr = pParams.getProfileParameters(); for (ProfileParameter pp : pParamsArr) { pParams.deleteProfileParameter(pp, acs); } } int rowsDeleted = deleteProfileImpl(profile, acs); nameMap.remove(profile.getName()); idMap.remove(profile.getId()); return rowsDeleted; } Profiles(Map<Integer, Profile> idMap, Map<String, Profile> nameMap); Profile getById(Integer id); Profile getByName(String name); Profile[] getProfiles(); @Override String toString(); void addOrChangeProfile(Profile profile, ACS acs); int deleteProfile(Profile profile, ACS acs, boolean cascade);  }### Answer:
@Test public void deleteProfile() throws SQLException { Unittype unittype = TestUtils.createUnittype("Test unittype", acs); Profile profile = TestUtils.createProfile("Test profile", unittype, acs); unittype.getProfiles().deleteProfile(profile, acs, true); Profile byName = unittype.getProfiles().getByName("Test profile"); assertNull(byName); }