bug4134_2: Removed unnecessary complicated creation of colorSet in ColorMapperTest

This commit is contained in:
Alessandro Stoltenberg
2018-08-17 13:34:23 +02:00
parent f001ad7296
commit 8accbac5d4
@@ -30,15 +30,7 @@ public class ColorMapperTest {
valueSet = new HashSet<>();
updateValueSet(valueSet);
colorSet = new HashSet<>();
updateColorSet(colorSet);
}
public void updateColorSet(Set<String> colorSet) {
colorSet.clear();
for (int i : valueSet) {
double h = (1 - (i - valueRange.getMinLeft()) / (valueRange.getMaxRight() - valueRange.getMinLeft())) * 240;
colorSet.add("hsl(" + Math.round(h) + ", 100%, 50%)");
}
fillColorSet();
}
public void updateValueSet(Set<Integer> valueSet) {
@@ -48,6 +40,12 @@ public class ColorMapperTest {
}
}
public void fillColorSet() {
for (int i = 0; i <= 240; i++) {
colorSet.add("hsl(" + i + ", 100%, 50%)");
}
}
@Test
public void testExceptionForValueOutOfBoundaries() {
try {
@@ -75,7 +73,6 @@ public class ColorMapperTest {
// verify Listener
verify(listener, times(1)).onColorMappingChanged();
updateValueSet(valueSet);
updateColorSet(colorSet);
// check if new values are within the colorSet
for (int i : valueSet) {
assertTrue(colorSet.contains(colorMapper.getColor(i)));