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.
For example...
@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);
}
}
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.