@Test
public void testValidationFailsOnDuplicateUrl() {
final String existingUrl = "http://example.com/existing_widget.xml";
WidgetImpl widget = new WidgetImpl();
widget.setId(123L);
widget.setTitle(VALID_TITLE);
widget.setType(VALID_TYPE);
widget.setDescription(VALID_DESCRIPTION);
widget.setUrl(existingUrl);
Widget newWidget = new WidgetImpl();
newWidget.setTitle(VALID_TITLE);
newWidget.setType(VALID_TYPE);
newWidget.setDescription(VALID_DESCRIPTION);
newWidget.setUrl(existingUrl);
Errors errors = new BindException(newWidget, WIDGET);
expect(widgetService.getWidgetByUrl(existingUrl)).andReturn(widget);
replay(widgetService);