Date createdDate = new Date();
Date lastModDate = new Date();
String text = "my comment";
User user = new UserImpl(VALID_USER_ID);
WidgetComment wc = new JpaWidgetComment();
wc.setCreatedDate(createdDate);
wc.setWidgetId(VALID_WIDGET_ID);
wc.setLastModifiedDate(lastModDate);
wc.setText(text);
wc.setUser(user);
assertThat(wc.getId(), is(nullValue()));
repository.save(wc);
long newId = wc.getId();
assertThat(newId > 0, is(true));
WidgetComment newComment = repository.get(newId);
assertThat(newComment.getWidgetId(), is(VALID_WIDGET_ID));
assertThat(newComment.getUser().getId(), is(VALID_USER_ID));
assertThat(newComment.getText(), is(text));
assertThat(newComment.getCreatedDate(), is(createdDate));
assertThat(newComment.getLastModifiedDate(), is(lastModDate));
}