コード例 #1
0
 @Test
 public void testIsEmbeddableAnnotated() {
   assertTrue(finder.isEmbeddableAnnotated(job.getClass()));
   assertFalse(finder.isEmbeddableAnnotated(person.getClass()));
   assertFalse(finder.isEmbeddableAnnotated(getClass()));
   assertFalse(finder.isEmbeddableAnnotated(null));
 }
コード例 #2
0
 @Test
 public void testFindMethodColumns() {
   Map<String, Class> columnMap = new HashMap<String, Class>();
   finder.findMethodColumns(Job.class, null, columnMap, false);
   String columnType = columnMap.get("job_name").getCanonicalName();
   assertTrue("expecting size == 2 but found " + columnMap.size(), columnMap.size() == 2);
   assertNotNull(
       "expecting not null but found " + columnMap.get("job_name"), columnMap.get("job_name"));
   assertNotNull(
       "expecting not null but found " + columnMap.get("postal_code"),
       columnMap.get("postal_code"));
   columnMap.clear();
   finder.findMethodColumns(Job.class, null, columnMap, true);
   assertTrue("expecting size == 1 but found " + columnMap.size(), columnMap.size() == 1);
   assertNotNull(
       "expecting not null but found " + columnMap.get("job_name"), columnMap.get("job_name"));
   columnMap.clear();
   finder.findMethodColumns(Address.class, "zipcode", columnMap, false);
   assertTrue("expecting size == 1 but found " + columnMap.size(), columnMap.size() == 1);
   assertNotNull(
       "expecting not null but found " + columnMap.get("postal_code"),
       columnMap.get("postal_code"));
   assertTrue(
       "expecting 'java.lang.String' but found " + columnMap.get("postal_code").getCanonicalName(),
       columnMap.get("postal_code").getCanonicalName().equals("java.lang.String"));
   columnMap.clear();
   finder.findMethodColumns(Address.class, "zipcode", columnMap, true);
   assertTrue("expecting size == 1 but found " + columnMap.size(), columnMap.size() == 1);
   assertNotNull(
       "expecting not null but found " + columnMap.get("postal_code"),
       columnMap.get("postal_code"));
   columnMap.clear();
   finder.findMethodColumns(Person.class, "", columnMap, false);
   assertTrue("expecting size == 2 but found " + columnMap.size(), columnMap.size() == 2);
   assertNotNull(
       "expecting not null but found " + columnMap.get("job_name"), columnMap.get("job_name"));
   assertNotNull(
       "expecting not null but found " + columnMap.get("postal_code"),
       columnMap.get("postal_code"));
   columnMap.clear();
   finder.findMethodColumns(Person.class, "", columnMap, true);
   assertTrue("expecting size == 0 but found " + columnMap.size(), columnMap.isEmpty());
   columnMap.clear();
   finder.findMethodColumns(Person.class, "name", columnMap, false);
   assertTrue("expecting size == 1 but found " + columnMap.size(), columnMap.size() == 1);
   assertNotNull(
       "expecting not null but found " + columnMap.get("job_name"), columnMap.get("job_name"));
   columnMap.clear();
   finder.findMethodColumns(Person.class, "name", columnMap, true);
   assertTrue("expecting size == 0 but found " + columnMap.size(), columnMap.isEmpty());
   columnMap.clear();
   finder.findMethodColumns(job.getClass(), "dummyMethodName", columnMap, false);
   assertTrue("expecting size == 0 but found " + columnMap.size(), columnMap.isEmpty());
 }
コード例 #3
0
  @Test
  public void testFindAllColumnNamesFrom() {
    checkColumnNameWith(finder.findAllColumnNamesFrom(job.getClass(), null, false));
    checkColumnNameWith(finder.findAllColumnNamesFrom(person.getClass(), "", false));

    Map<String, Class> columnMap = finder.findAllColumnNamesFrom(person.getClass(), "name", false);
    assertEquals(columnMap.get("job_name").getCanonicalName(), "java.lang.String");
    assertTrue("expecting size == 1 but found " + columnMap.size(), columnMap.size() == 1);

    columnMap = finder.findAllColumnNamesFrom(person.getClass(), "dummy", false);
    assertTrue("expecting size == 0 but found " + columnMap.size(), columnMap.isEmpty());

    columnMap = finder.findAllColumnNamesFrom(job.getClass(), null, true);
    assertTrue("expecting size == 2 but found " + columnMap.size(), columnMap.size() == 2);
    assertNotNull(
        "expecting not null but found " + columnMap.get("job_name"), columnMap.get("job_name"));
    assertNotNull(
        "expecting not null but found " + columnMap.get("summary"), columnMap.get("summary"));

    columnMap = finder.findAllColumnNamesFrom(person.getClass(), "", true);
    assertTrue("expecting size == 0 but found " + columnMap.size(), columnMap.isEmpty());
    columnMap = finder.findAllColumnNamesFrom(person.getClass(), "name", true);
    assertTrue("expecing size == 0 but found " + columnMap.size(), columnMap.isEmpty());
  }
コード例 #4
0
 @Test
 public void testFindFieldColumns() {
   Map<String, Class> columnMap = new HashMap<String, Class>();
   finder.findFieldColumns(job.getClass(), null, columnMap, false);
   String columnType = columnMap.get("summary").getCanonicalName();
   assertEquals(
       "expecting 'java.lang.String' but found " + columnType, columnType, "java.lang.String");
   columnMap.clear();
   finder.findFieldColumns(job.getClass(), null, columnMap, true);
   assertNotNull(
       "expecting not null but found " + columnMap.get("summary"), columnMap.get("summary"));
   assertTrue("expecting size == 1 but found " + columnMap.size(), columnMap.size() == 1);
   columnMap.clear();
   finder.findFieldColumns(person.getClass(), null, columnMap, false);
   columnType = columnMap.get("summary").getCanonicalName();
   assertTrue(
       "expecting 'java.lang.String' but found " + columnType,
       columnType.equals("java.lang.String"));
   columnMap.clear();
   finder.findFieldColumns(person.getClass(), null, columnMap, true);
   assertTrue("expecting size == 0 but found " + columnMap.size(), columnMap.isEmpty());
   columnMap.clear();
   finder.findFieldColumns(job.getClass(), "zipCode", columnMap, false);
   assertTrue("expecting size == 0 but found " + columnMap.size(), columnMap.isEmpty());
   columnMap.clear();
   finder.findFieldColumns(job.getClass(), "zipCode", columnMap, true);
   assertTrue("expecting size == 0 but found " + columnMap.size(), columnMap.isEmpty());
   columnMap.clear();
   finder.findFieldColumns(job.getClass(), "name", columnMap, true);
   assertTrue("expecting size == 0 but found " + columnMap.size(), columnMap.isEmpty());
   columnMap.clear();
   finder.findFieldColumns(job.getClass(), "dummyFieldName", columnMap, false);
   assertTrue("expecting size == 0 but found " + columnMap.size(), columnMap.isEmpty());
   columnMap.clear();
   finder.findFieldColumns(job.getClass(), "description", columnMap, true);
   assertTrue("expecting size == 1 but found " + columnMap.size(), columnMap.size() == 1);
   assertNotNull(
       "expecting not null but found " + columnMap.get("summary"), columnMap.get("summary"));
 }