StateListColourDrawableBuilder { public Drawable getDrawable() { StateListDrawable sld = new StateListDrawable(); for (StateColour stateColour : stateColoursList) { sld.addState(stateColour.states, new ColorDrawable(stateColour.colour)); } sld.addState(new int[]{}, new ColorDrawable(defaultColour)); return sld; } StateListColourDrawableBuilder(int defaultColour); StateListColourDrawableBuilder addStateColour(int[] states, int colour); Drawable getDrawable();  }
@Test public void can_create_state_list_drawable() { StateListColourDrawableBuilder builder = new StateListColourDrawableBuilder(Color.BLACK); assertNotNull(builder); Drawable d = builder.getDrawable(); assertNotNull(d); assertThat(d, instanceOf(StateListDrawable.class)); }