package com.projectsacrifice.game; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; import org.junit.Test; public final class PhysicalObjectStateTest { @Test public void authoredObjectPublishesStableMassGeometryAndRuntimeState() { LevelDefinition.PhysicalObject definition = new LevelDefinition.PhysicalObject( LevelDefinition.PhysicalObjectType.COUNTERWEIGHT, new LevelDefinition.Box(420f, 760f, 80f, 120f), 3); PhysicalObjectState state = new PhysicalObjectState(definition); state.velocity(120f, -30f).grounded(true).supportIndex(2); assertEquals(LevelDefinition.PhysicalObjectType.COUNTERWEIGHT, state.type()); assertEquals(420f, state.weightedX(), 0f); assertEquals(760f, state.weightedY(), 0f); assertEquals(80f, state.weightedWidth(), 0f); assertEquals(120f, state.weightedHeight(), 0f); assertEquals(3, state.pressureMass()); assertTrue(state.activatesPressure()); assertEquals(120f, state.velocityX(), 0f); assertEquals(-30f, state.velocityY(), 0f); assertTrue(state.grounded()); assertEquals(2, state.supportIndex()); } }