use of org.jabref.gui.cleanup.CleanupActionsListModel in project jabref by JabRef.
the class CleanupActionsListModelTest method resetFiresItemsChanged.
@Test
public void resetFiresItemsChanged() throws Exception {
CleanupActionsListModel model = new CleanupActionsListModel(Collections.emptyList());
ListDataListener listener = mock(ListDataListener.class);
model.addListDataListener(listener);
FieldFormatterCleanups defaultFormatters = mock(FieldFormatterCleanups.class);
model.reset(defaultFormatters);
ArgumentCaptor<ListDataEvent> argument = ArgumentCaptor.forClass(ListDataEvent.class);
verify(listener).contentsChanged(argument.capture());
assertEquals(ListDataEvent.CONTENTS_CHANGED, argument.getValue().getType());
}
use of org.jabref.gui.cleanup.CleanupActionsListModel in project jabref by JabRef.
the class CleanupActionsListModelTest method removedAtIndexMinus1DoesNothing.
@Test
public void removedAtIndexMinus1DoesNothing() {
CleanupActionsListModel model = new CleanupActionsListModel(getDefaultFieldFormatterCleanups());
ListDataListener listener = mock(ListDataListener.class);
model.addListDataListener(listener);
model.removeAtIndex(-1);
verifyZeroInteractions(listener);
}
use of org.jabref.gui.cleanup.CleanupActionsListModel in project jabref by JabRef.
the class CleanupActionsListModelTest method removedAtIndexOkay.
@Test
public void removedAtIndexOkay() {
CleanupActionsListModel model = new CleanupActionsListModel(getDefaultFieldFormatterCleanups());
ListDataListener listener = mock(ListDataListener.class);
model.addListDataListener(listener);
model.removeAtIndex(0);
ArgumentCaptor<ListDataEvent> argument = ArgumentCaptor.forClass(ListDataEvent.class);
verify(listener).intervalRemoved(argument.capture());
assertEquals(ListDataEvent.INTERVAL_REMOVED, argument.getValue().getType());
}
use of org.jabref.gui.cleanup.CleanupActionsListModel in project jabref by JabRef.
the class CleanupActionsListModelTest method removedAtIndexgreaterListSizeDoesNothing.
@Test
public void removedAtIndexgreaterListSizeDoesNothing() {
CleanupActionsListModel model = new CleanupActionsListModel(getDefaultFieldFormatterCleanups());
ListDataListener listener = mock(ListDataListener.class);
model.addListDataListener(listener);
model.removeAtIndex((getDefaultFieldFormatterCleanups().size() + 1));
verifyZeroInteractions(listener);
}
use of org.jabref.gui.cleanup.CleanupActionsListModel in project jabref by JabRef.
the class CleanupActionsListModelTest method resetSetsFormattersToPassedList.
@Test
public void resetSetsFormattersToPassedList() throws Exception {
CleanupActionsListModel model = new CleanupActionsListModel(Collections.emptyList());
FieldFormatterCleanups defaultFormatters = mock(FieldFormatterCleanups.class);
List<FieldFormatterCleanup> formatters = Arrays.asList(new FieldFormatterCleanup("test", new ClearFormatter()));
when(defaultFormatters.getConfiguredActions()).thenReturn(formatters);
model.reset(defaultFormatters);
assertEquals(formatters, model.getAllActions());
}
Aggregations