@Test
  public void updateMobileComponentsLocationWithError() throws Exception {
    final List<SensorLocationElement> resources = generateRandomList(SensorLocationElement.class);
    when(message.getLocations()).thenReturn(resources);
    doThrow(Exception.class).when(sensorService).findByName(anyString(), anyString());

    final CatalogResponseMessage response = controller.updateMobileComponentsLocation(message);

    verify(componentService, times(0)).updateAll(anyCollectionOf(Component.class));
    Assert.assertEquals(CatalogResponseMessage.INTERNAL_SERVER_ERROR, response.getCode());
  }
  @Test
  public void updateMobileComponentsLocation() throws Exception {
    final List<SensorLocationElement> resources = generateRandomSensorLocationList();
    when(message.getLocations()).thenReturn(resources);

    final CatalogResponseMessage response = controller.updateMobileComponentsLocation(message);

    verify(sensorService, times(resources.size())).findByName(anyString(), anyString());
    verify(componentService).updateAll(anyCollectionOf(Component.class));
    Assert.assertEquals(CatalogResponseMessage.OK, response.getCode());
  }