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