### Question:
Gradient { int[] generateColorMap(double opacity) { HashMap<Integer, ColorInterval> colorIntervals = generateColorIntervals(); int[] colorMap = new int[mColorMapSize]; ColorInterval interval = colorIntervals.get(0); int start = 0; for (int i = 0; i < mColorMapSize; i++) { if (colorIntervals.containsKey(i)) { interval = colorIntervals.get(i); start = i; } float ratio = (i - start) / interval.duration; colorMap[i] = interpolateColor(interval.color1, interval.color2, ratio); } if (opacity != 1) { for (int i = 0; i < mColorMapSize; i++) { int c = colorMap[i]; colorMap[i] = Color.argb((int) (Color.alpha(c) * opacity), Color.red(c), Color.green(c), Color.blue(c)); } } return colorMap; } Gradient(int[] colors, float[] startPoints);  Gradient(int[] colors, float[] startPoints, int colorMapSize);  final int mColorMapSize; public int[] mColors; public float[] mStartPoints; }### Answer:
@Test public void testMoreColorsThanColorMap() { int[] colors = {Color.argb(0, 0, 255, 0), GREEN, RED, BLUE}; float[] startPoints = {0f, 0.2f, 0.5f, 1f}; Gradient g = new Gradient(colors, startPoints, 2); int[] colorMap = g.generateColorMap(1.0); assertEquals(GREEN, colorMap[0]); assertEquals(RED, colorMap[1]); }