### Question:
AdminUnit extends ContentContainerObject { @Override public AdminUnit validateType() throws FedoraException { if (!isType(Cdr.AdminUnit.getURI())) { throw new ObjectTypeMismatchException("Object " + pid + " is not an AdminUnit."); } if (!isType(PcdmModels.Collection.getURI())) { throw new ObjectTypeMismatchException("Object " + pid + " is not a PCDM Collection."); } return this; } protected  AdminUnit(PID pid, RepositoryObjectDriver driver,
            RepositoryObjectFactory repoObjFactory); @Override ContentContainerObject addMember(ContentObject member); @Override AdminUnit validateType();  }### Answer:
@Test public void isValidTypeTest() { List<String> types = Arrays.asList(PcdmModels.Collection.getURI(), Cdr.AdminUnit.getURI()); when(driver.loadTypes(eq(unit))).thenAnswer(new Answer<RepositoryObjectDriver>() { @Override public RepositoryObjectDriver answer(InvocationOnMock invocation) throws Throwable { unit.setTypes(types); return driver; } }); unit.validateType(); }
@Test(expected = ObjectTypeMismatchException.class) public void invalidTypeTest() { List<String> types = Arrays.asList(PcdmModels.Object.getURI(), Cdr.Work.getURI()); when(driver.loadTypes(eq(unit))).thenAnswer(new Answer<RepositoryObjectDriver>() { @Override public RepositoryObjectDriver answer(InvocationOnMock invocation) throws Throwable { unit.setTypes(types); return driver; } }); unit.validateType(); }