BusinessObjectFormatExternalInterfaceDaoHelper { public BusinessObjectFormatExternalInterfaceEntity getBusinessObjectFormatExternalInterfaceEntity( BusinessObjectFormatExternalInterfaceKey businessObjectFormatExternalInterfaceKey) { BusinessObjectFormatEntity businessObjectFormatEntity = businessObjectFormatDao.getBusinessObjectFormatByAltKey( new BusinessObjectFormatKey(businessObjectFormatExternalInterfaceKey.getNamespace(), businessObjectFormatExternalInterfaceKey.getBusinessObjectDefinitionName(), businessObjectFormatExternalInterfaceKey.getBusinessObjectFormatUsage(), businessObjectFormatExternalInterfaceKey.getBusinessObjectFormatFileType(), null)); ExternalInterfaceEntity externalInterfaceEntity = null; if (businessObjectFormatEntity != null) { externalInterfaceEntity = externalInterfaceDao.getExternalInterfaceByName(businessObjectFormatExternalInterfaceKey.getExternalInterfaceName()); } BusinessObjectFormatExternalInterfaceEntity businessObjectFormatExternalInterfaceEntity = null; if (externalInterfaceEntity != null) { businessObjectFormatExternalInterfaceEntity = businessObjectFormatExternalInterfaceDao .getBusinessObjectFormatExternalInterfaceByBusinessObjectFormatAndExternalInterface(businessObjectFormatEntity, externalInterfaceEntity); } if (businessObjectFormatExternalInterfaceEntity == null) { throw new ObjectNotFoundException(String.format( "Business object format to external interface mapping with \"%s\" namespace, \"%s\" business object definition name, " + "\"%s\" business object format usage, \"%s\" business object format file type, and \"%s\" external interface name doesn't exist.", businessObjectFormatExternalInterfaceKey.getNamespace(), businessObjectFormatExternalInterfaceKey.getBusinessObjectDefinitionName(), businessObjectFormatExternalInterfaceKey.getBusinessObjectFormatUsage(), businessObjectFormatExternalInterfaceKey.getBusinessObjectFormatFileType(), businessObjectFormatExternalInterfaceKey.getExternalInterfaceName())); } return businessObjectFormatExternalInterfaceEntity; }  BusinessObjectFormatExternalInterfaceEntity getBusinessObjectFormatExternalInterfaceEntity(
        BusinessObjectFormatExternalInterfaceKey businessObjectFormatExternalInterfaceKey);  }
@Test public void testGetBusinessObjectFormatExternalInterfaceEntity() { BusinessObjectFormatExternalInterfaceKey businessObjectFormatExternalInterfaceKey = new BusinessObjectFormatExternalInterfaceKey(NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, EXTERNAL_INTERFACE); BusinessObjectFormatKey businessObjectFormatKey = new BusinessObjectFormatKey(NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, null); BusinessObjectFormatEntity businessObjectFormatEntity = new BusinessObjectFormatEntity(); ExternalInterfaceEntity externalInterfaceEntity = new ExternalInterfaceEntity(); BusinessObjectFormatExternalInterfaceEntity businessObjectFormatExternalInterfaceEntity = new BusinessObjectFormatExternalInterfaceEntity(); when(businessObjectFormatDao.getBusinessObjectFormatByAltKey(businessObjectFormatKey)).thenReturn(businessObjectFormatEntity); when(externalInterfaceDao.getExternalInterfaceByName(EXTERNAL_INTERFACE)).thenReturn(externalInterfaceEntity); when(businessObjectFormatExternalInterfaceDao .getBusinessObjectFormatExternalInterfaceByBusinessObjectFormatAndExternalInterface(businessObjectFormatEntity, externalInterfaceEntity)) .thenReturn(businessObjectFormatExternalInterfaceEntity); BusinessObjectFormatExternalInterfaceEntity result = businessObjectFormatExternalInterfaceDaoHelper.getBusinessObjectFormatExternalInterfaceEntity(businessObjectFormatExternalInterfaceKey); assertEquals(businessObjectFormatExternalInterfaceEntity, result); verify(businessObjectFormatDao).getBusinessObjectFormatByAltKey(businessObjectFormatKey); verify(externalInterfaceDao).getExternalInterfaceByName(EXTERNAL_INTERFACE); verify(businessObjectFormatExternalInterfaceDao) .getBusinessObjectFormatExternalInterfaceByBusinessObjectFormatAndExternalInterface(businessObjectFormatEntity, externalInterfaceEntity); verifyNoMoreInteractionsHelper(); }
@Test public void testGetBusinessObjectFormatExternalInterfaceEntityBusinessObjectFormatExternalInterfaceNoExists() { BusinessObjectFormatExternalInterfaceKey businessObjectFormatExternalInterfaceKey = new BusinessObjectFormatExternalInterfaceKey(NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, EXTERNAL_INTERFACE); BusinessObjectFormatKey businessObjectFormatKey = new BusinessObjectFormatKey(NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, null); BusinessObjectFormatEntity businessObjectFormatEntity = new BusinessObjectFormatEntity(); ExternalInterfaceEntity externalInterfaceEntity = new ExternalInterfaceEntity(); when(businessObjectFormatDao.getBusinessObjectFormatByAltKey(businessObjectFormatKey)).thenReturn(businessObjectFormatEntity); when(externalInterfaceDao.getExternalInterfaceByName(EXTERNAL_INTERFACE)).thenReturn(externalInterfaceEntity); when(businessObjectFormatExternalInterfaceDao .getBusinessObjectFormatExternalInterfaceByBusinessObjectFormatAndExternalInterface(businessObjectFormatEntity, externalInterfaceEntity)) .thenReturn(null); expectedException.expect(ObjectNotFoundException.class); expectedException.expectMessage(String.format("Business object format to external interface mapping with \"%s\" namespace, " + "\"%s\" business object definition name, \"%s\" business object format usage, \"%s\" business object format file type, and " + "\"%s\" external interface name doesn't exist.", NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, EXTERNAL_INTERFACE)); businessObjectFormatExternalInterfaceDaoHelper.getBusinessObjectFormatExternalInterfaceEntity(businessObjectFormatExternalInterfaceKey); verify(businessObjectFormatDao).getBusinessObjectFormatByAltKey(businessObjectFormatKey); verify(externalInterfaceDao).getExternalInterfaceByName(EXTERNAL_INTERFACE); verify(businessObjectFormatExternalInterfaceDao) .getBusinessObjectFormatExternalInterfaceByBusinessObjectFormatAndExternalInterface(businessObjectFormatEntity, externalInterfaceEntity); verifyNoMoreInteractionsHelper(); }
@Test public void testGetBusinessObjectFormatExternalInterfaceEntityBusinessObjectFormatNoExists() { BusinessObjectFormatExternalInterfaceKey businessObjectFormatExternalInterfaceKey = new BusinessObjectFormatExternalInterfaceKey(NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, EXTERNAL_INTERFACE); BusinessObjectFormatKey businessObjectFormatKey = new BusinessObjectFormatKey(NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, null); when(businessObjectFormatDao.getBusinessObjectFormatByAltKey(businessObjectFormatKey)).thenReturn(null); expectedException.expect(ObjectNotFoundException.class); expectedException.expectMessage(String.format("Business object format to external interface mapping with \"%s\" namespace, " + "\"%s\" business object definition name, \"%s\" business object format usage, \"%s\" business object format file type, and " + "\"%s\" external interface name doesn't exist.", NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, EXTERNAL_INTERFACE)); businessObjectFormatExternalInterfaceDaoHelper.getBusinessObjectFormatExternalInterfaceEntity(businessObjectFormatExternalInterfaceKey); verify(businessObjectFormatDao).getBusinessObjectFormatByAltKey(businessObjectFormatKey); verifyNoMoreInteractionsHelper(); }
@Test public void testGetBusinessObjectFormatExternalInterfaceEntityExternalInterfaceNoExists() { BusinessObjectFormatExternalInterfaceKey businessObjectFormatExternalInterfaceKey = new BusinessObjectFormatExternalInterfaceKey(NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, EXTERNAL_INTERFACE); BusinessObjectFormatKey businessObjectFormatKey = new BusinessObjectFormatKey(NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, null); BusinessObjectFormatEntity businessObjectFormatEntity = new BusinessObjectFormatEntity(); when(businessObjectFormatDao.getBusinessObjectFormatByAltKey(businessObjectFormatKey)).thenReturn(businessObjectFormatEntity); when(externalInterfaceDao.getExternalInterfaceByName(EXTERNAL_INTERFACE)).thenReturn(null); expectedException.expect(ObjectNotFoundException.class); expectedException.expectMessage(String.format("Business object format to external interface mapping with \"%s\" namespace, " + "\"%s\" business object definition name, \"%s\" business object format usage, \"%s\" business object format file type, and " + "\"%s\" external interface name doesn't exist.", NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, EXTERNAL_INTERFACE)); businessObjectFormatExternalInterfaceDaoHelper.getBusinessObjectFormatExternalInterfaceEntity(businessObjectFormatExternalInterfaceKey); verify(businessObjectFormatDao).getBusinessObjectFormatByAltKey(businessObjectFormatKey); verify(externalInterfaceDao).getExternalInterfaceByName(EXTERNAL_INTERFACE); verifyNoMoreInteractionsHelper(); }