Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -176,13 +176,11 @@ private AspectPropertyValue<Integer> getDifferenceInternal() {
* @return drift
*/
private AspectPropertyValue<Integer> getDriftInternal() {
int result = Integer.MAX_VALUE;
int total = 0;
for (ResultsHashSwig results : resultsList) {
if (results.getDrift() < result) {
result = results.getDrift();
}
total += results.getDrift();
}
return new AspectPropertyValueDefault<>(result);
return new AspectPropertyValueDefault<>(total);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@

import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.fail;
import static org.mockito.Mockito.*;

Expand Down Expand Up @@ -84,7 +85,32 @@ public void DeviceData_ResultsClose() throws Exception {
arg -> data);
flowData.close();
verify(results, times(1)).close();
}
}
}

/**
* Check that drift adds the drift of every native result, one per
* component, as the specification describes and the native results do.
* @throws Exception
*/
@Test
public void DeviceData_Drift_IsTheSumOfTheResults() throws Exception {
try (FlowData flowData = getWrapper().getPipeline().createFlowData()) {
DeviceDataHashDefault data = new DeviceDataHashDefault(
logger,
flowData,
getWrapper().getEngine(),
missingPropertyService);

ResultsHashSwig hardware = mock(ResultsHashSwig.class);
when(hardware.getDrift()).thenReturn(3);
ResultsHashSwig browser = mock(ResultsHashSwig.class);
when(browser.getDrift()).thenReturn(5);
data.setResults(hardware);
data.setResults(browser);

assertEquals(8, data.getDrift().getValue().intValue());
}
}

/**
Expand Down
Loading