column.setWidth(width);
// For saving the selected categories:
final List<Category> expectedCategories = asList(DATE, FILE);
final List<Category> actualCategories = Lists.newArrayList();
ICategoryProvider categoryProvider = mock(ICategoryProvider.class);
doAnswer(new Answer<Void>() {
@Override
public Void answer(InvocationOnMock invocation) throws Throwable {
for (Object obj : invocation.getArguments()) {
actualCategories.add((Category) obj);
}
return null;
}
}).when(categoryProvider)
.setSelected(expectedCategories.toArray(new Category[0]));
// Save the states:
helper
.saveCategories(expectedCategories.toArray(new Category[0]))
.saveVisualCategory(visualCategory)
.saveColumnWidths(new TreeColumn[]{column});
// Change the states:
categoryProvider.setSelected(FILE);
valueProvider.setVisualCategory(DATE);
column.setWidth(1);
// Restore:
helper