Package de.danielbechler.diff.introspection

Examples of de.danielbechler.diff.introspection.PropertyAccessor


  @Test
  public void testIsPrimitiveTypeReturnsPrimitiveClassForPrimitiveType() throws Exception
  {
    final Method readMethod = getClass().getDeclaredMethod("getTestValue");
    final PropertyAccessor accessor = new PropertyAccessor("testValue", readMethod, null);
    final Instances instances = new Instances(accessor, 1L, 2L, 0L);
    assertThat(instances.getType() == long.class).isTrue();
  }
View Full Code Here


  }

  @Test
  public void should_return_property_annotations_of_property_accessor() throws Exception
  {
    final PropertyAccessor propertyAccessor = Mockito.mock(PropertyAccessor.class);
    final Annotation annotation = Mockito.mock(Annotation.class);
    Mockito.when(propertyAccessor.getReadMethodAnnotations()).thenReturn(new LinkedHashSet<Annotation>(Arrays.asList(annotation)));
    final DiffNode node = new DiffNode(propertyAccessor, Object.class);

    final Set<Annotation> annotations = node.getPropertyAnnotations();

    assertThat(annotations).containsAll(Arrays.asList(annotation));
View Full Code Here

  }

  @Test
  public void should_return_empty_set_of_property_annotations_if_accessor_is_not_property_accessor() throws Exception
  {
    final PropertyAccessor propertyAccessor = Mockito.mock(PropertyAccessor.class);
    final Annotation annotation = Mockito.mock(Annotation.class);
    Mockito.when(propertyAccessor.getReadMethodAnnotations()).thenReturn(new LinkedHashSet<Annotation>(Arrays.asList(annotation)));
    final DiffNode node = new DiffNode(propertyAccessor, Object.class);

    final Set<Annotation> annotations = node.getPropertyAnnotations();

    assertThat(annotations).containsAll(Arrays.asList(annotation));
View Full Code Here

  }

  @Test
  public void getPropertyAnnotation_should_delegate_call_to_property_accessor()
  {
    final PropertyAccessor propertyAccessor = Mockito.mock(PropertyAccessor.class);
    Mockito.when(propertyAccessor.getReadMethodAnnotation(ObjectDiffTest.class)).thenReturn(null);

    new DiffNode(propertyAccessor, Object.class).getPropertyAnnotation(ObjectDiffTest.class);

    Mockito.verify(propertyAccessor, Mockito.times(1)).getReadMethodAnnotation(ObjectDiffTest.class);
  }
View Full Code Here

TOP

Related Classes of de.danielbechler.diff.introspection.PropertyAccessor

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.