### Question:
CatalogItemFinder { public <T extends CatalogItem> T filterVisible(T catalogItem, String locale) { if (catalogItem == null) { throw new WebApplicationException(Response.Status.NOT_FOUND); } if (!catalogItem.isVisible()) { throw new WebApplicationException((Response.Status.FORBIDDEN)); } catalogItem.setLocalizedPresentation(locale); return catalogItem; } CatalogItemFinder();  CatalogItemFinder(EntityManager entityManager); List<T> findVisibleCatalogItems(EntityPath<T> entityPath, List<T> items, String locale); List<T> findAll(EntityPath<T> entityPath, Integer offset, Integer limit, String orderBy, Boolean isDesc); List<P> findForeignHolder(EntityPath<P> hp,
                                                                                    ListPath<T, ? extends SimpleExpression<T>> h, T c); List<T> findBySearchCriteria(EntityPath<T> entityPath, String searchCriteria,
                                                                Integer offset, Integer limit, String orderBy, Boolean isDesc); Long countAll(EntityPath<? extends CatalogItem> entityPath); Long countBySearchCriteria(EntityPath<? extends CatalogItem> entityPath, String searchCriteria); T filterVisible(T catalogItem, String locale);  }### Answer:
@Test public void find_VisibleCatalogItem_ShouldReturnExpectedProduct() { assertThat(instance.filterVisible(visibleCatalogItem, null)).isEqualTo(visibleCatalogItem); }
@Test public void find_NotVisibleCatalogItem_ShouldThrowForbiddenException() { try { instance.filterVisible(new Catalog(), null); fail("should have thrown ex"); } catch (WebApplicationException e) { assertEquals(Response.Status.FORBIDDEN, e.getResponse().getStatusInfo()); } }
@Test public void find_NullCatalogItem_ShouldThrowNotFoundException() { try { instance.filterVisible(null, null); fail("should have thrown ex"); } catch (WebApplicationException e) { assertEquals(Response.Status.NOT_FOUND, e.getResponse().getStatusInfo()); } }