favoriteTask.fullCommandLine = "nonexistanttask"; //change the task's full name
return true;
}
public void reportError(String error) {
throw new AssertionFailedError("unexpected error: " + error);
}
});
//make sure we were notified
context.assertIsSatisfied();
//make sure the settings were changed
favoriteTask = editor.getFavoriteTasks().get(0);
Assert.assertEquals("newname", favoriteTask.getDisplayName());
Assert.assertEquals("nonexistanttask", favoriteTask.getFullCommandLine());
Assert.assertFalse(!favoriteTask.alwaysShowOutput());
//now change the full name back. Make sure the task is changed back.
//reset our expectations. We'll get notified again.
context.checking(new Expectations() {{
one(observer).favoritesChanged();
}});
//now perform the edit.
editor.editFavorite(favoriteTask, new FavoritesEditor.EditFavoriteInteraction() {
public boolean editFavorite(FavoritesEditor.EditibleFavoriteTask favoriteTask) {
favoriteTask.displayName = "newname";
favoriteTask.fullCommandLine = "mysubproject1:compile"; //change the task's full name
return true;
}
public void reportError(String error) {
throw new AssertionFailedError("unexpected error: " + error);
}
});
//make sure we were notified
context.assertIsSatisfied();