ViewGroupColorAdapter implements ColorAdapter<ViewGroup> { @Override public int getColor(ViewGroup view) { Drawable bg = view.getBackground(); if(bg instanceof ColorDrawable){ return ((ColorDrawable) bg).getColor(); } return 0; }  @Override void applyColor(ViewGroup view, @ColorInt int color); @Override int getColor(ViewGroup view);  }
@Test public void getColor() throws Exception { int color = Color.GREEN; adapter.applyColor(view, color); int appliedColor = adapter.getColor(view); assertThat(appliedColor, is(color)); }