use of org.spongepowered.api.util.Angle in project SpongeCommon by SpongePowered.
the class TransformationTest method testRotatingAroundOrigin180DegreesAroundYAxisWithTwoSteps.
@ParameterizedTest
@MethodSource("testRotatingAroundOrigin180DegreesAroundYAxis")
void testRotatingAroundOrigin180DegreesAroundYAxisWithTwoSteps(final Vector3d original, final Vector3d expected) {
// and this rotation
final Rotation mockRotation = Mockito.mock(Rotation.class, Mockito.withSettings().defaultAnswer(Mockito.CALLS_REAL_METHODS));
Mockito.when(mockRotation.angle()).thenReturn(Angle.fromDegrees(90));
Mockito.when(mockRotation.and(Mockito.any(Rotation.class))).thenAnswer((Answer<Rotation>) invocation -> {
final Rotation rotation = invocation.getArgument(0);
final Rotation newMock = Mockito.mock(Rotation.class, Mockito.withSettings().defaultAnswer(Mockito.CALLS_REAL_METHODS));
Mockito.when(newMock.angle()).thenAnswer((Answer<Angle>) x -> Angle.fromDegrees(rotation.angle().degrees() + 90));
return newMock;
});
final Transformation transformation = this.performRotationTest(mockRotation, original, expected, Vector3d.ZERO, 2);
Assertions.assertEquals(180, transformation.rotation().angle().degrees(), "Did not get expected angle.");
}
Aggregations