mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-09-24 14:38:45 +00:00
bug4134_2: Removed unnecessary complicated creation of colorSet in ColorMapperTest
This commit is contained in:
+7
-10
@@ -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)));
|
||||
|
||||
Reference in New Issue
Block a user