@Test public void testSingleItemInListHasAllRoundedCorners() { ListItemBackgroundResolver.setBackground(mMockView, 0, 1); verify(mMockView).setBackgroundResource(R.drawable.car_card_rounded_background); }
public static void setBackground(View view, int currentPosition, int totalItems) { if (currentPosition < 0) { throw new IllegalArgumentException("currentPosition cannot be less than zero."); } if (currentPosition >= totalItems) { throw new IndexOutOfBoundsException("currentPosition: " + currentPosition + "; " + "totalItems: " + totalItems); } if (totalItems == 1) { view.setBackgroundResource(R.drawable.car_card_rounded_background); } else if (currentPosition == 0) { view.setBackgroundResource(R.drawable.car_card_rounded_top_background); } else if (currentPosition == totalItems - 1) { view.setBackgroundResource(R.drawable.car_card_rounded_bottom_background); } else { view.setBackgroundResource(R.drawable.car_card_background); } }
ListItemBackgroundResolver { public static void setBackground(View view, int currentPosition, int totalItems) { if (currentPosition < 0) { throw new IllegalArgumentException("currentPosition cannot be less than zero."); } if (currentPosition >= totalItems) { throw new IndexOutOfBoundsException("currentPosition: " + currentPosition + "; " + "totalItems: " + totalItems); } if (totalItems == 1) { view.setBackgroundResource(R.drawable.car_card_rounded_background); } else if (currentPosition == 0) { view.setBackgroundResource(R.drawable.car_card_rounded_top_background); } else if (currentPosition == totalItems - 1) { view.setBackgroundResource(R.drawable.car_card_rounded_bottom_background); } else { view.setBackgroundResource(R.drawable.car_card_background); } } }
ListItemBackgroundResolver { public static void setBackground(View view, int currentPosition, int totalItems) { if (currentPosition < 0) { throw new IllegalArgumentException("currentPosition cannot be less than zero."); } if (currentPosition >= totalItems) { throw new IndexOutOfBoundsException("currentPosition: " + currentPosition + "; " + "totalItems: " + totalItems); } if (totalItems == 1) { view.setBackgroundResource(R.drawable.car_card_rounded_background); } else if (currentPosition == 0) { view.setBackgroundResource(R.drawable.car_card_rounded_top_background); } else if (currentPosition == totalItems - 1) { view.setBackgroundResource(R.drawable.car_card_rounded_bottom_background); } else { view.setBackgroundResource(R.drawable.car_card_background); } } private  ListItemBackgroundResolver(); }
ListItemBackgroundResolver { public static void setBackground(View view, int currentPosition, int totalItems) { if (currentPosition < 0) { throw new IllegalArgumentException("currentPosition cannot be less than zero."); } if (currentPosition >= totalItems) { throw new IndexOutOfBoundsException("currentPosition: " + currentPosition + "; " + "totalItems: " + totalItems); } if (totalItems == 1) { view.setBackgroundResource(R.drawable.car_card_rounded_background); } else if (currentPosition == 0) { view.setBackgroundResource(R.drawable.car_card_rounded_top_background); } else if (currentPosition == totalItems - 1) { view.setBackgroundResource(R.drawable.car_card_rounded_bottom_background); } else { view.setBackgroundResource(R.drawable.car_card_background); } } private  ListItemBackgroundResolver(); static void setBackground(View view, int currentPosition, int totalItems); }
ListItemBackgroundResolver { public static void setBackground(View view, int currentPosition, int totalItems) { if (currentPosition < 0) { throw new IllegalArgumentException("currentPosition cannot be less than zero."); } if (currentPosition >= totalItems) { throw new IndexOutOfBoundsException("currentPosition: " + currentPosition + "; " + "totalItems: " + totalItems); } if (totalItems == 1) { view.setBackgroundResource(R.drawable.car_card_rounded_background); } else if (currentPosition == 0) { view.setBackgroundResource(R.drawable.car_card_rounded_top_background); } else if (currentPosition == totalItems - 1) { view.setBackgroundResource(R.drawable.car_card_rounded_bottom_background); } else { view.setBackgroundResource(R.drawable.car_card_background); } } private  ListItemBackgroundResolver(); static void setBackground(View view, int currentPosition, int totalItems);  }