Source:
public void testCreateOrUpdate() throws MiddlewareQueryException { MeasurementRow row = this.createMeasurementRow(); VariableList factors = this.createVariableList(); Geolocation geolocation = this.geolocationSaver.createOrUpdate(factors, row, null); assertNotNull(geolocation); assertEquals(EnvironmentVariable.TRIAL_INSTANCE.getValue(), geolocation.getDescription()); assertEquals(EnvironmentVariable.LATITUDE.getValue(), geolocation.getLatitude().toString()); assertEquals(EnvironmentVariable.LONGITUDE.getValue(), geolocation.getLongitude().toString()); assertEquals(EnvironmentVariable.GEODETIC_DATUM.getValue(), geolocation.getGeodeticDatum()); assertEquals(EnvironmentVariable.ALTITUDE.getValue(), geolocation.getAltitude().toString()); assertNotNull(geolocation.getProperties()); assertEquals(4, geolocation.getProperties().size()); int propertyIndex = 0; assertGeoPropertiesLoop: for (GeolocationProperty property : geolocation.getProperties()) { propertyIndex++; EnvironmentVariable environmentVariable = null; switch (propertyIndex) { case 1: environmentVariable = EnvironmentVariable.ENV_1; break; case 2: environmentVariable = EnvironmentVariable.ENV_2; break; case 3: environmentVariable = EnvironmentVariable.ENV_3; break; case 4: assertEquals(String.valueOf(GeolocationSaverTest.EXPERIMENT_DESIGN_FACTOR_RCBD_ID), property.getValue()); continue assertGeoPropertiesLoop; } assertTrue(environmentVariable.getId() == property.getTypeId()); assertEquals(environmentVariable.getValue(), property.getValue()); } assertEquals(2, geolocation.getVariates().size()); int variateIndex = 0; for (Variable variable : geolocation.getVariates().getVariables()) { variateIndex++; EnvironmentVariable environmentVariable = null; switch (variateIndex) { case 1: environmentVariable = EnvironmentVariable.VARIATE_1; break; case 2: environmentVariable = EnvironmentVariable.VARIATE_2; break; } assertEquals(environmentVariable.getValue(), variable.getValue()); } }

Target:
public void testCreateOrUpdate() throws MiddlewareQueryException { MeasurementRow row = this.createMeasurementRow(); VariableList factors = this.createVariableList(); Geolocation geolocation = this.geolocationSaver.createOrUpdate(factors, row, null); assertNotNull(geolocation); assertEquals(EnvironmentVariable.TRIAL_INSTANCE.getValue(), geolocation.getDescription()); assertEquals(EnvironmentVariable.LATITUDE.getValue(), geolocation.getLatitude().toString()); assertEquals(EnvironmentVariable.LONGITUDE.getValue(), geolocation.getLongitude().toString()); assertEquals(EnvironmentVariable.GEODETIC_DATUM.getValue(), geolocation.getGeodeticDatum()); assertEquals(EnvironmentVariable.ALTITUDE.getValue(), geolocation.getAltitude().toString()); assertNotNull(geolocation.getProperties()); assertEquals(4, geolocation.getProperties().size()); int propertyIndex = 0; for (GeolocationProperty property : geolocation.getProperties()) { propertyIndex++; EnvironmentVariable environmentVariable = null; if (propertyIndex == 4) { assertEquals(String.valueOf(GeolocationSaverTest.EXPERIMENT_DESIGN_FACTOR_RCBD_ID), property.getValue()); continue; } switch (propertyIndex) { case 1: environmentVariable = EnvironmentVariable.ENV_1; break; case 2: environmentVariable = EnvironmentVariable.ENV_2; break; case 3: environmentVariable = EnvironmentVariable.ENV_3; break; } assertTrue(environmentVariable.getId() == property.getTypeId()); assertEquals(environmentVariable.getValue(), property.getValue()); } assertEquals(2, geolocation.getVariates().size()); int variateIndex = 0; for (Variable variable : geolocation.getVariates().getVariables()) { variateIndex++; EnvironmentVariable environmentVariable = null; switch (variateIndex) { case 1: environmentVariable = EnvironmentVariable.VARIATE_1; break; case 2: environmentVariable = EnvironmentVariable.VARIATE_2; break; } assertEquals(environmentVariable.getValue(), variable.getValue()); } }