### Question:
WorkObject extends ContentContainerObject { public FileObject getPrimaryObject() { Resource resc = getResource(); Statement primaryStmt = resc.getProperty(Cdr.primaryObject); if (primaryStmt == null) { return null; } PID primaryPid = PIDs.get(primaryStmt.getResource().getURI()); return driver.getRepositoryObject(primaryPid, FileObject.class); } protected  WorkObject(PID pid, RepositoryObjectDriver driver, RepositoryObjectFactory repoObjFactory); @Override WorkObject validateType(); void clearPrimaryObject(); void setPrimaryObject(PID primaryPid); FileObject getPrimaryObject(); @Override ContentContainerObject addMember(ContentObject member); FileObject addDataFile(URI storageUri, String filename, String mimetype,
            String sha1Checksum, String md5Checksum); FileObject addDataFile(URI storageUri, String filename,
            String mimetype, String sha1Checksum, String md5Checksum, Model model); FileObject addDataFile(PID filePid, URI storageUri, String filename,
            String mimetype, String sha1Checksum, String md5Checksum, Model model);  }### Answer:
@Test public void getPrimaryObjectTest() { PID primaryPid = makePid(); Resource primaryResc = createResource(primaryPid.getURI()); when(driver.getRepositoryObject(eq(primaryPid), eq(FileObject.class))).thenReturn(fileObj); resc.addProperty(Cdr.primaryObject, primaryResc); FileObject resultObj = work.getPrimaryObject(); assertEquals(resultObj, fileObj); }
@Test public void getNoPrimaryObjectTest() { FileObject resultObj = work.getPrimaryObject(); assertNull(resultObj); verify(driver, never()).getRepositoryObject(any(PID.class), eq(FileObject.class)); }