title: Unit testing fetchtype lazy
body: <p>I have the following code:</p>
  
  <pre><code>@Entity
  public class Foo {
  
  @OneToMany(mappedBy = "Foo", fetch = FetchType.LAZY)
      @Cascade({ CascadeType.ALL, CascadeType.DELETE_ORPHAN })
  private Collection&lt;Bar&gt; bars;
  }
  
  @Entity
  public class Bar {
  
  @ManyToOne
  private Foo foo;
  }
  </code></pre>
  
  <p>I am trying to unit test the DAO class.</p>
  
  <pre><code>@Transactionl
  public class TestDao {
  
  @Test
  public void testLazy (){
  Foo foo = dao.findById(1);
  assertTrue(foo.getBars() != null &amp;&amp; !foo.getBars().isEmpty())
  //SOME CODE THAT I NEED YOUR HELP WITH
  assertTrue(foo.getBars() == null || foo.getBars().isEmpty())
  }
  
  @Test
  test1...
  
  @Test
  test2...
  
  @Test
  test3...
  
  }
  </code></pre>
  
  <p>I need help figuring out what //SOME CODE THAT I NEED YOUR HELP WITH
  needs to be for this test to pass.</p>
  
  <p>Thanks for the help
  Netta</p>