### Question:
Unittypes { public int deleteUnittype(Unittype unittype, ACS acs, boolean cascade) throws SQLException { if (!acs.getUser().isUnittypeAdmin(unittype.getId())) { throw new IllegalArgumentException("Not allowed action for this user"); } if (cascade) { UnittypeParameters utParams = unittype.getUnittypeParameters(); UnittypeParameter[] utParamsArr = utParams.getUnittypeParameters(); Profile defaultProfile = unittype.getProfiles().getByName("Default"); if (defaultProfile != null && unittype.getProfiles().getProfiles().length == 1 && defaultProfile.getProfileParameters().getProfileParameters().length == 0) { unittype.getProfiles().deleteProfile(defaultProfile, acs, false); } utParams.deleteUnittypeParameters(Arrays.asList(utParamsArr), acs); Groups groups = unittype.getGroups(); for (Group g : groups.getGroups()) { groups.deleteGroup(g, acs); } SyslogEvents syslogEvents = unittype.getSyslogEvents(); for (SyslogEvent sg : syslogEvents.getSyslogEvents()) { if (sg.getUnittype() != null) { syslogEvents.deleteSyslogEventImpl(sg, acs); } } } int rowsDeleted = deleteUnittypeImpl(unittype, acs); nameMap.remove(unittype.getName()); idMap.remove(unittype.getId()); return rowsDeleted; } Unittypes(Map<String, Unittype> nameMap, Map<Integer, Unittype> idMap); Unittype getByName(String name); Unittype getById(Integer id); Unittype[] getUnittypes(); @Override String toString(); void addOrChangeUnittype(Unittype unittype, ACS acs); int deleteUnittype(Unittype unittype, ACS acs, boolean cascade);  }### Answer:
@Test public void deleteUnittype() throws SQLException { String unittypeName = "Name"; Unittype unittype = TestUtils.createUnittype(unittypeName, acs); acs.getUnittypes().deleteUnittype(unittype, acs, true); Unittype byName = acs.getUnittypes().getByName(unittypeName); assertNull(byName); }