### Question:
TrayIcons { public Image tomato() { int size = tray.iconSize().height; Image image = tomato(size); if (image == null) { image = tomato(DEFAULT_ICON_SIZE); } return image; }  @Inject void setResources(Resources resources); @Inject void setTray(Tray tray); @Inject void setLook(Look look); @Inject void setCaches(Caches caches); Image tomato(); Image time(Time time); static final int DEFAULT_ICON_SIZE; }### Answer:
@Test public void testTomato() { Image expectedIcon = mock(Image.class); when(resources.image(resourceName(TRAY_ICON_SIZE))).thenReturn(expectedIcon); Image icon = trayIcons.tomato(); assertThat(icon, equalTo(expectedIcon)); }
@Test public void testDefaultTomatoIcon() { Image defaultIcon = mock(Image.class); when(resources.image(resourceName(TrayIcons.DEFAULT_ICON_SIZE))).thenReturn(defaultIcon); Image icon = trayIcons.tomato(); assertThat(icon, equalTo(defaultIcon)); }