assertNull(ratingRepository.getRatingById(widgetId, id));
}
@Test
public void save_Id_Valid(){
WidgetRatingImpl item = new WidgetRatingImpl();
WidgetRatingImpl lookup = new WidgetRatingImpl();
String widgetId = "2134";
String userId = "3245";
String id = "3245";
int score = 838;
item.setUserId(userId);
item.setScore(score);
item.setId(id);
lookup.setId(id);
Widget widget = new WidgetImpl();
widget.setRatings(Arrays.asList((WidgetRating)lookup));
expect(template.get(widgetId)).andReturn(widget);
expect(template.save(widget)).andReturn(widget);
replay(template);
WidgetRating widgetRating = ratingRepository.updateWidgetRating(widgetId, item);
assertThat(item.getScore(), is(equalTo(lookup.getScore())));
assertThat(item.getUserId(), is(equalTo(lookup.getUserId())));
assertThat(item.getScore(), is(equalTo(lookup.getScore())));
assertThat(widgetRating, is(sameInstance((WidgetRating)lookup)));
}