}
@Test
public void updateShouldSetTheCellColorUsingTheGivenColorProvider()
throws Exception {
ViewerCell cell = newCell(0, new Object());
IValueProvider valueProvider = mock(IValueProvider.class);
given(valueProvider.shouldPaint(cell.getElement())).willReturn(TRUE);
Display display = PlatformUI.getWorkbench().getDisplay();
Color foreground = display.getSystemColor(SWT.COLOR_CYAN);
Color background = display.getSystemColor(SWT.COLOR_BLUE);
IColorProvider colors = mock(IColorProvider.class);
given(colors.getForeground(cell.getElement())).willReturn(foreground);
given(colors.getBackground(cell.getElement())).willReturn(background);
TreePathDurationLabelProvider labelProvider =
new TreePathDurationLabelProvider(valueProvider, colors);
labelProvider.update(cell);
assertThat(cell.getForeground(), is(foreground));
assertThat(cell.getBackground(), is(background));
}