use of net.bytebuddy.implementation.bytecode.StackManipulation in project byte-buddy by raphw.
the class ReferenceTypeAwareAssignerTest method testTargetToSourceAssignable.
@Test(expected = IllegalStateException.class)
public void testTargetToSourceAssignable() throws Exception {
defineAssignability(false, true);
StackManipulation stackManipulation = ReferenceTypeAwareAssigner.INSTANCE.assign(source, target, Assigner.Typing.STATIC);
assertThat(stackManipulation.isValid(), is(false));
stackManipulation.apply(methodVisitor, implementationContext);
}
use of net.bytebuddy.implementation.bytecode.StackManipulation in project byte-buddy by raphw.
the class AssignerEqualTypesOnlyTest method testAssignmentErasureNotEqual.
@Test
public void testAssignmentErasureNotEqual() throws Exception {
StackManipulation stackManipulation = Assigner.EqualTypesOnly.ERASURE.assign(first, second, Assigner.Typing.of(dynamicallyTyped));
assertThat(stackManipulation.isValid(), is(false));
verify(first).asErasure();
verifyNoMoreInteractions(first);
verify(second).asErasure();
verifyNoMoreInteractions(second);
}
use of net.bytebuddy.implementation.bytecode.StackManipulation in project byte-buddy by raphw.
the class AssignerRefusingTest method testAssignmentEqual.
@Test
public void testAssignmentEqual() throws Exception {
StackManipulation stackManipulation = Assigner.Refusing.INSTANCE.assign(first, first, Assigner.Typing.of(dynamicallyTyped));
assertThat(stackManipulation.isValid(), is(false));
}
use of net.bytebuddy.implementation.bytecode.StackManipulation in project byte-buddy by raphw.
the class AssignerRefusingTest method testAssignmentNotEqual.
@Test
public void testAssignmentNotEqual() throws Exception {
StackManipulation stackManipulation = Assigner.Refusing.INSTANCE.assign(first, second, Assigner.Typing.of(dynamicallyTyped));
assertThat(stackManipulation.isValid(), is(false));
}
use of net.bytebuddy.implementation.bytecode.StackManipulation in project byte-buddy by raphw.
the class PrimitiveTypeAwareAssignerImplicitUnboxingTest method testImplicitUnboxingAssignment.
@Test
public void testImplicitUnboxingAssignment() {
StackManipulation stackManipulation = primitiveAssigner.assign(source, target, Assigner.Typing.DYNAMIC);
assertThat(stackManipulation.isValid(), is(assignable));
verify(chainedStackManipulation).isValid();
verifyNoMoreInteractions(chainedStackManipulation);
verify(source, atLeast(0)).represents(any(Class.class));
verify(source, atLeast(1)).isPrimitive();
verify(source).asGenericType();
verifyNoMoreInteractions(source);
verify(target, atLeast(0)).represents(any(Class.class));
verify(target, atLeast(1)).isPrimitive();
verifyNoMoreInteractions(target);
verify(chainedAssigner).assign(source, new TypeDescription.Generic.OfNonGenericType.ForLoadedType(wrapperType), Assigner.Typing.DYNAMIC);
verifyNoMoreInteractions(chainedAssigner);
}
Aggregations