title: Play Framework's generic methods giving me a headache
body: <p>I have this method in a Directory model:</p>
  
  <pre><code>public List&lt;Directory&gt; subdirectories() {
      return find("select d from Directory d where d.parent = ?", this.id).fetch()
  }
  </code></pre>
  
  <p>And this test:</p>
  
  <pre><code>@Test
  public void testSubdirectories() {
      Directory d1 = Directory.find("byName", "d1").first();
      Directory d2 = Directory.find("byName", "d2").first();
      Directory d3 = Directory.find("byName", "d3").first();
      Directory d4 = Directory.find("byName", "d4").first();
  
      List&lt;Directory&gt; d1subs = d1.subdirectories();
      List&lt;Directory&gt; d2subs = d2.subdirectories();
      List&lt;Directory&gt; d3subs = d3.subdirectories();
      List&lt;Directory&gt; d4subs = d4.subdirectories();
  
      assertTrue(d1subs.contains(d2));
      assertTrue(d1subs.contains(d3));
      assertTrue(d2subs.isEmpty());
      assertFalse(d1subs.contains(d4));
      assertTrue(d3subs.contains(d4));
      assertTrue(d4subs.isEmpty());
  }
  </code></pre>
  
  <p>This typechecks, but when I run the tests, I get the following error:</p>
  
  <pre><code>A java.lang.IllegalArgumentException has been caught, Parameter value [5] was not matching type [models.Directory]
  In /test/models/DirectoryTest.java, line 37 :
  List&lt;Directory&gt; d1subs = d1.subdirectories();
  </code></pre>
  
  <p>Can anyone explain what the problem is, and how to fix it?</p>