title: Unit Tests for JPA/Persistence in General
body: <p>How/would you test super-simple methods that are built on a persistence engine. I'm going to use JPA but any persistence mechanism I'm sure has its equivelents.</p>
  
  <p>For example...</p>
  
  <pre><code>@Entity
  public class Category {
  
     @Id @GeneratedValue
     private long id;
  
     @NotNull @NotEmpty
     private String name;
  
     @NotNull
     @ManyToOne
     private User user;
  
     //...Getters/Setters...
  }
  
  @Stateless
  public void CategoryServiceImpl implements CategoryService {
  
     @PersistenceContext EntityManager entityManager;
     public void addCategory(Category input) {
        entityManager.persist(input);
     }
  }
  </code></pre>
  
  <p>What kind of tests would be useful for addCategory. I can see the usefulness of TDD and unit testing but I'm just not sure what kinds of tests to do for simple methods like that. Not really looking for "how" to create the tests but "what" to test.</p>