SearchIndexTypeDaoHelper { public SearchIndexTypeEntity getSearchIndexTypeEntity(String code) throws ObjectNotFoundException { SearchIndexTypeEntity searchIndexTypeEntity = searchIndexTypeDao.getSearchIndexTypeByCode(code); if (searchIndexTypeEntity == null) { throw new ObjectNotFoundException(String.format("Search index type with code \"%s\" doesn't exist.", code)); } return searchIndexTypeEntity; }  SearchIndexTypeEntity getSearchIndexTypeEntity(String code);  }
@Test public void testGetSearchIndexTypeEntity() { SearchIndexTypeEntity searchIndexTypeEntity = searchIndexTypeDaoTestHelper.createSearchIndexTypeEntity(SEARCH_INDEX_TYPE); assertEquals(searchIndexTypeEntity, searchIndexTypeDaoHelper.getSearchIndexTypeEntity(SEARCH_INDEX_TYPE)); assertEquals(searchIndexTypeEntity, searchIndexTypeDaoHelper.getSearchIndexTypeEntity(SEARCH_INDEX_TYPE.toUpperCase())); assertEquals(searchIndexTypeEntity, searchIndexTypeDaoHelper.getSearchIndexTypeEntity(SEARCH_INDEX_TYPE.toLowerCase())); try { searchIndexTypeDaoHelper.getSearchIndexTypeEntity(I_DO_NOT_EXIST); fail(); } catch (ObjectNotFoundException e) { assertEquals(String.format("Search index type with code \"%s\" doesn't exist.", I_DO_NOT_EXIST), e.getMessage()); } }