mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-10-04 03:13:49 +00:00
fixed little colormap bug and added a test to ensure the calculation of 100 distinct colors
This commit is contained in:
1 parent
09ce87180c
commit
5c23c6121b
2 files changed
+30
-2
No files matched your search
@@ -0,0 +1,28 @@
|
||||
package com.sap.sailing.gwt.ui.test;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import com.sap.sailing.gwt.ui.client.ColorMap;
|
||||
|
||||
public class ColorMapTest {
|
||||
|
||||
@Test
|
||||
public void testHundredDistinctColors() {
|
||||
ColorMap<Integer> colorMap = new ColorMap<Integer>();
|
||||
List<String> existingColors = new ArrayList<String>();
|
||||
int amountOfDistinctColorsToCreate = 100;
|
||||
for(int i = 1; i <= amountOfDistinctColorsToCreate; i++) {
|
||||
String colorByID = colorMap.getColorByID(i);
|
||||
if(!existingColors.contains(colorByID)) {
|
||||
existingColors.add(colorByID);
|
||||
}
|
||||
}
|
||||
assertEquals(amountOfDistinctColorsToCreate, existingColors.size());
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user