コード例 #1
0
 private PropertyAwareAccessor given_introspector_returns_PropertyAccessor(
     final String propertyName) {
   final BeanPropertyElement propertyElement = new BeanPropertyElement(propertyName);
   final PropertyAwareAccessor propertyAccessor = mock(PropertyAwareAccessor.class);
   when(propertyAccessor.getPathElement()).thenReturn(propertyElement);
   final Set<PropertyAwareAccessor> propertyAccessors = Collections.singleton(propertyAccessor);
   when(introspector.introspect(any(Class.class))).thenReturn(propertyAccessors);
   return propertyAccessor;
 }
コード例 #2
0
  @BeforeMethod
  public void setUp() {
    initMocks(this);

    when(instances.getSourceAccessor()).thenReturn(RootAccessor.getInstance());
    when(instances.getType())
        .then(
            new Answer<Object>() {
              public Object answer(final InvocationOnMock invocation) throws Throwable {
                return String.class;
              }
            });
    when(introspectorResolver.introspectorForNode(any(DiffNode.class))).thenReturn(introspector);
    when(introspector.introspect(any(Class.class)))
        .thenReturn(Collections.<PropertyAwareAccessor>emptyList());

    beanDiffer =
        new BeanDiffer(
            differDispatcher,
            introspectableResolver,
            returnableResolver,
            comparisonStrategyResolver,
            introspectorResolver);
  }