/** Test fetch light by id. */ @Test public void testFetchLightById() { // Success situation LightRequest lightRequest = TestBaseUtil.createLightRequest(); Light light = TestBaseUtil.createLight(); lightRequest.addLight(light); InternalResultsResponse<Light> response = getSmartPointAccessorBCL().fetchLightById(lightRequest); assertResultResponse(response); lightRequest = TestBaseUtil.createLightRequest(); light = TestBaseUtil.createLight(); light.getLightLocation().setZipCode("OffSetNegative"); lightRequest.addLight(light); response = getSmartPointAccessorBCL().fetchLightById(lightRequest); assertResultResponse(response); resetMocksToSmartPointArea(); // Error situation setSituation( getSmartPointAccessorBCL(), SituationsEnum.ERROR, ISmartPointDAC.class, "fetchLightById"); lightRequest = TestBaseUtil.createLightRequest(); light = TestBaseUtil.createLight(); lightRequest.addLight(light); response = getSmartPointAccessorBCL().fetchLightById(lightRequest); assertMessages(response, ERROR_CODE); }
/** * Insert lights. * * @return the list */ private List<Light> insertLights() { List<Light> lightList = new ArrayList<Light>(); Light light = new Light(); light.setId(1); StatusMessage statusMessage = new StatusMessage(); statusMessage.setLightStatusEnum(LightStatusEnum.ALARM); light.setLightIntensityEnum(LightIntensityEnum.LEVEL_5); light.setCurrentStatusMessage(statusMessage); light.setRniId(1); light.setSmartPointId(1); lightList.add(light); light = new Light(); light.setId(2); statusMessage = new StatusMessage(); statusMessage.setLightStatusEnum(LightStatusEnum.WARNING); light.setLightIntensityEnum(LightIntensityEnum.LEVEL_6); light.setCurrentStatusMessage(statusMessage); light.setRniId(2); light.setSmartPointId(2); lightList.add(light); return lightList; }