title: Testing Hibernate DAO using Junit
body: <p>I am using a combination of Spring and Hibernate in my project and would like to test the DAO methods like <code>Save</code> and <code>Delete</code> methods.</p>
  
  <p>daoFoundation is a wrapper class created over hibernateSession.</p>
  
  <pre class="lang-java prettyprint-override"><code>@Override
  public String createSubject(Subject subject) {
      String subjectId = (String) daoFoundation.save(subject);
      return subjectId;
  }
  </code></pre>
  
  <p>This is what I wrote in my JUnit Runs with SpringJunit4ClassRunner<br>
  I created the subject object in my SetupMethod.</p>
  
  <pre class="lang-java prettyprint-override"><code>@Test
  public void createSubjectTest(){
      subjectDao.createSubject(subject);
      assertNotNull(hassSubjectSelection.getId());
  }
  </code></pre>
  
  <p>Is this sufficient or do I need to write anything additional in my test class?</p>