final String personName = "Phil Plait";
final String personEmail = "phil.plait@awesome.com";
final String themeUrl = "src/main/webapp/themes/vegas.xml";
final String themeCategory = "CITY";
final Theme theme = new Theme(themeUrl, themeName, themeDesc, null, null, null, personName, personEmail);
final HashMap<String, Serializable> formData = new HashMap<String, Serializable>();
formData.put("url", themeUrl);
formData.put("category", themeCategory);
final GalleryItemCategory galleryItemCategory = new GalleryItemCategory(themeCategory);
final String url = themeUrl;
final String category = themeCategory;
final Map<String, Serializable> fields = new HashMap<String, Serializable>();
fields.put("url", url);
fields.put("category", category);
context.checking(new Expectations()
{
{
oneOf(userDetails).getParams();
will(returnValue(fields));
oneOf(galleryItemGetter).provide(userDetails, formData);
will(returnValue(theme));
oneOf(galleryItemPopulator).populate(theme, url);
oneOf(galleryItemCategoryMapper).findByName(GalleryItemType.THEME, category);
will(returnValue(galleryItemCategory));
oneOf(galleryItemSaver).save(theme);
}
});
// Make the call
Theme actual = (Theme) sutTheme.execute(userDetails);
context.assertIsSatisfied();
assertSame(theme, actual);
assertEquals("property should be gotten", themeName, theme.getName());