### Question:
Classifier { public ClientResourceType findResourceType( final FolderItem folderItem ) { if ( folderItem.getItem() instanceof Path ) { return findResourceType( (Path) folderItem.getItem() ); } throw new IllegalArgumentException( "Invalid FolderItem type." ); }  @PostConstruct void init(); Map<ClientResourceType, Collection<FolderItem>> group( final Collection<FolderItem> folderItems ); ClientResourceType findResourceType( final FolderItem folderItem ); ClientResourceType findResourceType( final Path path );  }### Answer:
@Test public void successfullyFindResourceTypeByPathTest() { final Path path = mock( Path.class ); doReturn( true ).when( clientResourceType ).accept( path ); final ClientResourceType resourceType = classifier.findResourceType( path ); assertNotNull( resourceType ); assertEquals( clientResourceType, resourceType ); }
@Test(expected = IllegalArgumentException.class) public void unsuccessfullyFindResourceTypeByPathTest() { final Path path = mock( Path.class ); doReturn( false ).when( clientResourceType ).accept( path ); classifier.findResourceType( path ); }
@Test public void successfullyFindResourceTypeByFolderItemTest() { final FolderItem folderItem = mock( FolderItem.class ); final Path path = mock( Path.class ); doReturn( path ).when( folderItem ).getItem(); doReturn( true ).when( clientResourceType ).accept( path ); final ClientResourceType resourceType = classifier.findResourceType( folderItem ); assertNotNull( resourceType ); assertEquals( clientResourceType, resourceType ); }
@Test(expected = IllegalArgumentException.class) public void unsuccessfullyFindResourceTypeByFolderItemTest() { final FolderItem folderItem = mock( FolderItem.class ); final Path path = mock( Path.class ); doReturn( path ).when( folderItem ).getItem(); doReturn( false ).when( clientResourceType ).accept( path ); classifier.findResourceType( folderItem ); }