### Question:
SingleRepositoryServiceImpl implements SingleRepositoryService { @Override public FileResourceData getFileResourceData(String uri) { Resource resource = repositoryService.getResource(null, uri); if (resource == null) { throw new IllegalStateException("Resource " + uri + " not found"); } return getFileResourceData(resource); }  @Override Resource getResource(String uri); @Override FileResourceData getFileResourceData(String uri); @Override FileResourceData getFileResourceData(Resource resource); @Override void deleteResource(String uri); @Override Resource createResource(Resource serverResource, String parentUri, boolean createFolders, boolean dryRun); ClientResource saveOrUpdate(ClientResource clientResource, boolean overwrite, boolean createFolders,
            String clientType, boolean dryRun, Map<String, String[]> additionalProperties); @Override Resource updateResource(Resource resource, boolean dryRun); @Override String copyResource(String sourceUri, String destinationUri, boolean createFolders, boolean overwrite, String renameTo); @Override String moveResource(String sourceUri, String destinationUri, boolean createFolders, boolean overwrite,
            String renameTo); @Override Resource createFileResource(InputStream stream, String parentFolderUri, String name, String label,
            String description, String type, boolean createFolders, boolean dryRun); @Override Resource updateFileResource(InputStream stream, String parentUri, String name, String label, String description, String type, boolean dryRun); @Override String getUniqueName(String parenUri, String name);  }### Answer:
@Test(groups = "GET") public void testGetFileResourceData_file() throws Exception { FileResourceData data = new FileResourceData(new byte[10]); FileResource file = new FileResourceImpl(); file.setURIString("/test/index.html"); Mockito.when(repositoryService.getResourceData(nullable(ExecutionContext.class), anyString())).thenReturn(data); Mockito.when(repositoryService.getContentResourceData(nullable(ExecutionContext.class), anyString())).thenReturn(data); assertSame(service.getFileResourceData(file), data); verify(repositoryService, only()).getResourceData(nullable(ExecutionContext.class), eq(file.getURIString())); verify(repositoryService, never()).getContentResourceData(nullable(ExecutionContext.class), anyString()); }
@Test(groups = "GET") public void testGetFileResourceData_contentResource() throws Exception { FileResourceData data = new FileResourceData(new byte[10]); ContentResource file = new ContentResourceImpl(); file.setURIString("/test/index.html"); Mockito.when(repositoryService.getResourceData(nullable(ExecutionContext.class), anyString())).thenReturn(data); Mockito.when(repositoryService.getContentResourceData(nullable(ExecutionContext.class), anyString())).thenReturn(data); assertSame(service.getFileResourceData(file), data); verify(repositoryService, never()).getResourceData(nullable(ExecutionContext.class), anyString()); verify(repositoryService, only()).getContentResourceData(nullable(ExecutionContext.class), eq(file.getURIString())); }
@Test(groups = "GET", expectedExceptions = {IllegalStateException.class}) public void testGetFileResourceData_not_a_file() throws Exception { FileResourceData data = new FileResourceData(new byte[10]); Resource file = new ResourceLookupImpl(); file.setURIString("/test/index.html"); service.getFileResourceData(file); }