BusinessObjectDefinitionDescriptionSuggestionStatusDaoHelper { public BusinessObjectDefinitionDescriptionSuggestionStatusEntity getBusinessObjectDefinitionDescriptionSuggestionStatusEntity(String code) throws ObjectNotFoundException { BusinessObjectDefinitionDescriptionSuggestionStatusEntity businessObjectDefinitionDescriptionSuggestionStatusEntity = businessObjectDefinitionDescriptionSuggestionStatusDao.getBusinessObjectDefinitionDescriptionSuggestionStatusByCode(code); if (businessObjectDefinitionDescriptionSuggestionStatusEntity == null) { throw new ObjectNotFoundException(String.format("Business object definition description suggestion status with code \"%s\" doesn't exist.", code)); } return businessObjectDefinitionDescriptionSuggestionStatusEntity; }  BusinessObjectDefinitionDescriptionSuggestionStatusEntity getBusinessObjectDefinitionDescriptionSuggestionStatusEntity(String code);  }
@Test public void testGetBusinessObjectDefinitionDescriptionSuggestionStatusEntity() { BusinessObjectDefinitionDescriptionSuggestionStatusEntity businessObjectDefinitionDescriptionSuggestionStatusEntity = new BusinessObjectDefinitionDescriptionSuggestionStatusEntity(); businessObjectDefinitionDescriptionSuggestionStatusEntity.setCode(BDEF_DESCRIPTION_SUGGESTION_STATUS); when(businessObjectDefinitionDescriptionSuggestionStatusDao .getBusinessObjectDefinitionDescriptionSuggestionStatusByCode(BDEF_DESCRIPTION_SUGGESTION_STATUS)) .thenReturn(businessObjectDefinitionDescriptionSuggestionStatusEntity); BusinessObjectDefinitionDescriptionSuggestionStatusEntity result = businessObjectDefinitionDescriptionSuggestionStatusDaoHelper .getBusinessObjectDefinitionDescriptionSuggestionStatusEntity(BDEF_DESCRIPTION_SUGGESTION_STATUS); assertThat("Result does not equal businessObjectDefinitionDescriptionSuggestionStatusEntity.", result, is(equalTo(businessObjectDefinitionDescriptionSuggestionStatusEntity))); verify(businessObjectDefinitionDescriptionSuggestionStatusDao) .getBusinessObjectDefinitionDescriptionSuggestionStatusByCode(BDEF_DESCRIPTION_SUGGESTION_STATUS); verifyNoMoreInteractions(businessObjectDefinitionDescriptionSuggestionStatusDao); }
@Test public void testGetBusinessObjectDefinitionDescriptionSuggestionStatusEntityWithException() { when(businessObjectDefinitionDescriptionSuggestionStatusDao .getBusinessObjectDefinitionDescriptionSuggestionStatusByCode(BDEF_DESCRIPTION_SUGGESTION_STATUS)).thenReturn(null); try { businessObjectDefinitionDescriptionSuggestionStatusDaoHelper .getBusinessObjectDefinitionDescriptionSuggestionStatusEntity(BDEF_DESCRIPTION_SUGGESTION_STATUS); fail(); } catch (ObjectNotFoundException objectNotFoundException) { assertThat("Exception message is not correct.", objectNotFoundException.getMessage(), is(equalTo(String .format("Business object definition description suggestion status with code \"%s\" doesn't exist.", BDEF_DESCRIPTION_SUGGESTION_STATUS)))); } verify(businessObjectDefinitionDescriptionSuggestionStatusDao) .getBusinessObjectDefinitionDescriptionSuggestionStatusByCode(BDEF_DESCRIPTION_SUGGESTION_STATUS); verifyNoMoreInteractions(businessObjectDefinitionDescriptionSuggestionStatusDao); }