.iterator().next());
}
@Test
public void testSaveIssuesList() throws Exception {
IssuesManager m = new IssuesManager();
IIssuesList issuesList = new IssuesList();
m.setIssuesList(issuesList);
issuesList.add(IssuesListTestHelper.createFeatureIssue("1")); //$NON-NLS-1$
// no exception happens, and nothing else.
assertFalse(m.save(new NullProgressMonitor()));
DataStore[] store = new DataStore[1];
SimpleFeatureType[] featureType = new SimpleFeatureType[1];
issuesList = IssuesListTestHelper.createInMemoryDatastoreIssuesList(store, featureType);
m.setIssuesList(issuesList);
FeatureIssue createIssue = IssuesListTestHelper.createFeatureIssue("2"); //$NON-NLS-1$
issuesList.add(createIssue);
issuesList.add(IssuesListTestHelper.createFeatureIssue("3")); //$NON-NLS-1$
assertFalse(m.save(new NullProgressMonitor()));
createIssue.setPriority(Priority.TRIVIAL);
class Listener implements IIssuesListListener {
private Collection< ? extends IIssue> saved;
public void notifyChange( IssuesListEvent event ) {
if (event.getType() == IssuesListEventType.SAVE)
saved = event.getChanged();
}
};
Listener listener = new Listener();
issuesList.addListener(listener);
assertTrue(m.save(new NullProgressMonitor()));
assertEquals(1, listener.saved.size());
assertEquals(createIssue.getId(), listener.saved.iterator().next().getId());
}