@Test public void checkGetKind_object() { TypeMirror typeMirror = mock(TypeMirror.class); when(typeMirror.getKind()).thenReturn(TypeKind.OTHER); when(typeMirror.toString()).thenReturn(Object.class.getCanonicalName()); VariableElement element = mock(VariableElement.class); when(element.asType()).thenReturn(typeMirror); FieldModel model = new FieldModel(element, mock(EntityModel.class)); Helper helper = mock(Helper.class); when(helper.isACollection(any(TypeMirror.class))).thenReturn(false); ASSERT.that(FieldKind.object).isEqualTo(model.getKind(helper)); }
public static FieldKind getKind(Helper helper, VariableElement element) { final FieldKind fieldKind; final TypeMirror typeMirror = element.asType(); if (typeMirror.getKind().isPrimitive()) { fieldKind = primitive; } else if (isSimpleObject(typeMirror.toString())) { fieldKind = simpleObject; } else if (helper.isACollection(typeMirror)) { fieldKind = collection; } else { fieldKind = object; } return fieldKind; }
FieldModel { public static FieldKind getKind(Helper helper, VariableElement element) { final FieldKind fieldKind; final TypeMirror typeMirror = element.asType(); if (typeMirror.getKind().isPrimitive()) { fieldKind = primitive; } else if (isSimpleObject(typeMirror.toString())) { fieldKind = simpleObject; } else if (helper.isACollection(typeMirror)) { fieldKind = collection; } else { fieldKind = object; } return fieldKind; } }
FieldModel { public static FieldKind getKind(Helper helper, VariableElement element) { final FieldKind fieldKind; final TypeMirror typeMirror = element.asType(); if (typeMirror.getKind().isPrimitive()) { fieldKind = primitive; } else if (isSimpleObject(typeMirror.toString())) { fieldKind = simpleObject; } else if (helper.isACollection(typeMirror)) { fieldKind = collection; } else { fieldKind = object; } return fieldKind; } FieldModel(VariableElement element, EntityModel dependency); }
FieldModel { public static FieldKind getKind(Helper helper, VariableElement element) { final FieldKind fieldKind; final TypeMirror typeMirror = element.asType(); if (typeMirror.getKind().isPrimitive()) { fieldKind = primitive; } else if (isSimpleObject(typeMirror.toString())) { fieldKind = simpleObject; } else if (helper.isACollection(typeMirror)) { fieldKind = collection; } else { fieldKind = object; } return fieldKind; } FieldModel(VariableElement element, EntityModel dependency); static FieldKind getKind(Helper helper, VariableElement element); VariableElement getElement(); String getName(); TypeModel getType(); String getPropertyKey(); EntityModel getDependency(); @Override boolean equals(Object o); @Override int hashCode(); FieldKind getKind(Helper helper); }
FieldModel { public static FieldKind getKind(Helper helper, VariableElement element) { final FieldKind fieldKind; final TypeMirror typeMirror = element.asType(); if (typeMirror.getKind().isPrimitive()) { fieldKind = primitive; } else if (isSimpleObject(typeMirror.toString())) { fieldKind = simpleObject; } else if (helper.isACollection(typeMirror)) { fieldKind = collection; } else { fieldKind = object; } return fieldKind; } FieldModel(VariableElement element, EntityModel dependency); static FieldKind getKind(Helper helper, VariableElement element); VariableElement getElement(); String getName(); TypeModel getType(); String getPropertyKey(); EntityModel getDependency(); @Override boolean equals(Object o); @Override int hashCode(); FieldKind getKind(Helper helper);  }