Package org.mongolink.utils

Examples of org.mongolink.utils.FieldContainer


        assertThat(entity.getValues().size(), is(1));
        assertThat(entity.getValues().get("testkey"), is("testvalue"));
    }

    private MapMapper createMapper() throws NoSuchMethodException {
        final MapMapper result = new MapMapper(new FieldContainer(EntityWithHashmap.class.getMethod("getValues", null)));
        final MapperContext context = new MapperContext();
        final ClassMapper classMapper = mock(ClassMapper.class);
        when(classMapper.getContext()).thenReturn(context);
        return result;
    }
View Full Code Here


        assertThat((UUID) dbValue, is(id));
    }

    @Test
    public void canSaveANullId() {
        final FieldContainer fieldContainer = mock(FieldContainer.class);
        when(fieldContainer.value(any())).thenReturn(null);
        IdMapper mapper = new IdMapper(fieldContainer, IdGeneration.Auto);
        final BasicDBObject dbObject = new BasicDBObject();

        mapper.save(new Object(), dbObject);
View Full Code Here

        PropertyInterceptor interceptor = new PropertyInterceptor(aggregateMap);
        Method method = FakeAggregate.class.getDeclaredMethod("getId");

        interceptor.intercept(new Object(), method, null, null);

        verify(aggregateMap).setLastMethod(new FieldContainer(method));
    }
View Full Code Here

    @Override
    public Object intercept(Object obj, Method method, Object[] args, MethodProxy proxy) throws Throwable {
        if(isGroovyStrangeMethod(method)) {
            return null;
        }
        classMap.setLastMethod(new FieldContainer(method));
        return null;
    }
View Full Code Here

    }

    protected abstract ClassMapper<T> getMapper();

    protected final FieldContainer fieldContainer(String fieldName) {
        return new FieldContainer(Fields.find(persistentType(), fieldName));
    }
View Full Code Here

        assertThat(instance.getValue(), is(TestEnum.bad));
    }

    private PropertyMapper mapperForEnum() throws NoSuchMethodException {
        PropertyMapper propertyMapper = new PropertyMapper(new FieldContainer(FakeEntity.class.getDeclaredMethod("getValue")));
        propertyMapper.setMapper(parentMapper());
        return propertyMapper;
    }
View Full Code Here

        assertThat(object.get("primitive"), is((Object) 10));
    }

    private PropertyMapper mapperForProperty() throws NoSuchMethodException {
        final PropertyMapper propertyMapper = new PropertyMapper(new FieldContainer(primitiveGetter()));
        propertyMapper.setMapper(parentMapper());
        return propertyMapper;
    }
View Full Code Here

        assertThat(instance.getCreationDate(), is(dateTime));
    }

    private PropertyMapper propertyMapperForDateTime() throws NoSuchMethodException {
        final PropertyMapper result = new PropertyMapper(new FieldContainer(FakeEntity.class.getDeclaredMethod("getCreationDate")));
        result.setMapper(parentMapper());
        return result;
    }
View Full Code Here

        assertThat(instance.getDateOfDay(), is(localDate));
    }

    private PropertyMapper propertyMapperForLocalDate() throws NoSuchMethodException {
        final PropertyMapper result = new PropertyMapper(new FieldContainer(FakeEntity.class.getDeclaredMethod("getDateOfDay")));
        result.setMapper(parentMapper());
        return result;
    }
View Full Code Here

        assertThat(basicDBObject.get("k"), nullValue());
        assertThat(basicDBObject.get("ok"), is((Object) true));
    }

    private PropertyMapper propertyMapperForBoolean() throws NoSuchMethodException {
        final PropertyMapper propertyMapper = new PropertyMapper(new FieldContainer(primitiveBooleanGetter()));
        propertyMapper.setMapper(parentMapper());
        return propertyMapper;
    }
View Full Code Here

TOP

Related Classes of org.mongolink.utils.FieldContainer

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.