@Test
public void buildIndex_works() throws Exception {

    JdbcIndex<TestModel> index = builder.buildIndex(TestModel.class);
    assertEquals(TestModel.class.getCanonicalName(), index.getName());
    assertEquals(3, index.getFields().size());
    IndexField[] fields = index.getFields().toArray(new IndexField[3]);
    Arrays.sort(fields, new Comparator<IndexField>() {
        @Override
        public int compare(IndexField o1, IndexField o2) {
            return o1.getName().compareTo(o2.getName());
        }
    });
    assertEquals("subModel", fields[0].getName());
    assertEquals(SubTestModel.class, fields[0].getType());
    assertEquals("testId", fields[1].getName());
    assertEquals(String.class, fields[1].getType());
    assertEquals("testInteger", fields[2].getName());
    assertEquals(Integer.class, fields[2].getType());
}