示例#1
0
  @Test(expected = IllegalArgumentException.class)
  public void testEmptyParameterInIsType() {

    Field[] declaredFields = Peopple.class.getDeclaredFields();

    FieldTools fieldTool = new FieldTools(declaredFields[0]);

    fieldTool.isType(null);
  }
示例#2
0
  @Test
  public void testSameType() {

    Field[] declaredFields = Peopple.class.getDeclaredFields();

    FieldTools fieldTool = new FieldTools(declaredFields[0]);

    Boolean result = fieldTool.isType(String.class);

    assertTrue(result);
  }
示例#3
0
  @Test
  public void testClassDotAttributeName() {

    final String expected = "peopple.name";

    Field[] declaredFields = Peopple.class.getDeclaredFields();

    FieldTools fieldTool = new FieldTools(declaredFields[0]);

    String result = fieldTool.getClassDotName();

    assertEquals(expected, result);
  }
示例#4
0
  @Test
  public void testInJspNamed() {

    final String expected = "${peopple.name}";

    Field[] declaredFields = Peopple.class.getDeclaredFields();

    FieldTools fieldTool = new FieldTools(declaredFields[0]);

    String result = fieldTool.getInJspNamed();

    assertEquals(expected, result);
  }
示例#5
0
  @Test
  public void testOwnerClassInSimpleName() {

    final String expected = "peopple";

    Field[] declaredFields = Peopple.class.getDeclaredFields();

    FieldTools fieldTool = new FieldTools(declaredFields[0]);

    String result = fieldTool.getDeclaringClassinSimpleName();

    assertEquals(expected, result);
  }