Search in sources :

Example 1 with TypeMirrorWrapper

use of org.robobinding.codegen.apt.type.TypeMirrorWrapper in project RoboBinding by RoboBinding.

the class ElementWrapper method create.

public static ElementWrapper create(Types types, Elements elements, Messager messager) {
    TypeMirrorWrapper typeWrapper = new TypeMirrorWrapper(types, elements);
    ElementWrapper elementWrapper = new ElementWrapper(typeWrapper, new MessagerLoggerFactory(messager), types, elements);
    return elementWrapper;
}
Also used : TypeMirrorWrapper(org.robobinding.codegen.apt.type.TypeMirrorWrapper) MessagerLoggerFactory(org.robobinding.codegen.apt.MessagerLoggerFactory)

Example 2 with TypeMirrorWrapper

use of org.robobinding.codegen.apt.type.TypeMirrorWrapper in project RoboBinding by RoboBinding.

the class ElementWrapperTest method whenWrapSupportedElements_thenReturnCoorespondingWrappedInstance.

@Theory
public void whenWrapSupportedElements_thenReturnCoorespondingWrappedInstance(@FromDataPoints("supportedElements") ElementToWrapped elementToWrapped) {
    Mockery context = new ClassMockery();
    final TypeMirrorWrapper typeWrapper = context.mock(TypeMirrorWrapper.class);
    context.checking(new Expectations() {

        {
            allowing(typeWrapper).wrap(with(any(TypeMirror.class)));
            will(returnValue(null));
        }
    });
    ElementWrapper wrapper = new ElementWrapper(typeWrapper, null, null, null);
    AbstractWrappedElement wrapped = wrapper.wrap(elementToWrapped.element);
    assertThat(wrapped, isA(elementToWrapped.wrappedType));
}
Also used : Expectations(org.jmock.Expectations) TypeMirror(javax.lang.model.type.TypeMirror) TypeMirrorWrapper(org.robobinding.codegen.apt.type.TypeMirrorWrapper) ClassMockery(org.robobinding.codegen.ClassMockery) ClassMockery(org.robobinding.codegen.ClassMockery) Mockery(org.jmock.Mockery) Theory(org.junit.experimental.theories.Theory)

Aggregations

TypeMirrorWrapper (org.robobinding.codegen.apt.type.TypeMirrorWrapper)2 TypeMirror (javax.lang.model.type.TypeMirror)1 Expectations (org.jmock.Expectations)1 Mockery (org.jmock.Mockery)1 Theory (org.junit.experimental.theories.Theory)1 ClassMockery (org.robobinding.codegen.ClassMockery)1 MessagerLoggerFactory (org.robobinding.codegen.apt.MessagerLoggerFactory)1