Tests that the default palette matches the constants of HSSFColor
PaletteRecord palette = new PaletteRecord();
//make sure all the HSSFColor constants match
Map colors = HSSFColor.getIndexHash();
Iterator indexes = colors.keySet().iterator();
while (indexes.hasNext())
{
Integer index = (Integer) indexes.next();
HSSFColor c = (HSSFColor) colors.get(index);
short[] rgbTriplet = c.getTriplet();
byte[] paletteTriplet = palette.getColor(index.shortValue());
String msg = "Expected HSSFColor constant to match PaletteRecord at index 0x"
+ Integer.toHexString(c.getIndex());
assertEquals(msg, rgbTriplet[0], paletteTriplet[0] & 0xff);
assertEquals(msg, rgbTriplet[1], paletteTriplet[1] & 0xff);
assertEquals(msg, rgbTriplet[2], paletteTriplet[2] & 0xff);
}