StorageUnitStatusDaoHelper { public StorageUnitStatusEntity getStorageUnitStatusEntity(String code) throws ObjectNotFoundException { StorageUnitStatusEntity storageUnitStatusEntity = storageUnitStatusDao.getStorageUnitStatusByCode(code); if (storageUnitStatusEntity == null) { throw new ObjectNotFoundException(String.format("Storage unit status \"%s\" doesn't exist.", code)); } return storageUnitStatusEntity; }  StorageUnitStatusEntity getStorageUnitStatusEntity(String code);  }
@Test public void testGetStorageUnitStatusEntity() { List<StorageUnitStatusEntity> storageUnitStatusEntity = Arrays.asList(storageUnitStatusDaoTestHelper.createStorageUnitStatusEntity(STORAGE_UNIT_STATUS), storageUnitStatusDaoTestHelper.createStorageUnitStatusEntity(STORAGE_UNIT_STATUS_2)); assertEquals(storageUnitStatusEntity.get(0), storageUnitStatusDaoHelper.getStorageUnitStatusEntity(STORAGE_UNIT_STATUS)); assertEquals(storageUnitStatusEntity.get(1), storageUnitStatusDaoHelper.getStorageUnitStatusEntity(STORAGE_UNIT_STATUS_2)); assertEquals(storageUnitStatusEntity.get(0), storageUnitStatusDaoHelper.getStorageUnitStatusEntity(STORAGE_UNIT_STATUS.toUpperCase())); assertEquals(storageUnitStatusEntity.get(0), storageUnitStatusDaoHelper.getStorageUnitStatusEntity(STORAGE_UNIT_STATUS.toLowerCase())); try { storageUnitStatusDaoHelper.getStorageUnitStatusEntity("I_DO_NOT_EXIST"); fail("Should throw an ObjectNotFoundException."); } catch (ObjectNotFoundException e) { assertEquals("Storage unit status \"I_DO_NOT_EXIST\" doesn't exist.", e.getMessage()); } }