fixed little colormap bug and added a test to ensure the calculation of 100 distinct colors

This commit is contained in:
fmittag committed 2012-06-22 12:15:24 +02:00
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());
}
}