@Test(expected = ConstraintViolationException.class) public void testPersistWithoutAuthor() throws Exception { final BlogEntry blogEntry = new BlogEntryTestdataBuilder(entityManager) .build(); blogEntry.setAuthor(null); databaseRule.getTransactionHelper().executeInTransaction( new VoidRunnable() { @Override public void doRun(EntityManager entityManager) throws Exception { entityManager.persist(blogEntry); } }); }
public void setAuthor(User author) { this.author = author; }
BlogEntry extends AbstractEntity { public void setAuthor(User author) { this.author = author; } }
BlogEntry extends AbstractEntity { public void setAuthor(User author) { this.author = author; }  }
BlogEntry extends AbstractEntity { public void setAuthor(User author) { this.author = author; }  String getTitle(); void setTitle(String title); String getContent(); void setContent(String content); String getShortContent(); User getAuthor(); void setAuthor(User author); Date getCreated(); List<Comment> getComments(); void addComment(Comment comment); boolean removeComment(Comment comment); }
BlogEntry extends AbstractEntity { public void setAuthor(User author) { this.author = author; }  String getTitle(); void setTitle(String title); String getContent(); void setContent(String content); String getShortContent(); User getAuthor(); void setAuthor(User author); Date getCreated(); List<Comment> getComments(); void addComment(Comment comment); boolean removeComment(Comment comment);  }