### Question:
Skeleton extends Entity { @Override public void update() { if (patrollingLeft) { position -= 1; if (position == PATROLLING_LEFT_BOUNDING) { patrollingLeft = false; } } else { position += 1; if (position == PATROLLING_RIGHT_BOUNDING) { patrollingLeft = true; } } logger.info("Skeleton " + id + " is on position " + position + "."); } Skeleton(int id);  Skeleton(int id, int postition); @Override void update();  }### Answer:
@Test public void testUpdateForPatrollingLeft() { skeleton.patrollingLeft = true; skeleton.setPosition(50); skeleton.update(); Assert.assertEquals(49, skeleton.getPosition()); }
@Test public void testUpdateForPatrollingRight() { skeleton.patrollingLeft = false; skeleton.setPosition(50); skeleton.update(); Assert.assertEquals(51, skeleton.getPosition()); }
@Test public void testUpdateForReverseDirectionFromLeftToRight() { skeleton.patrollingLeft = true; skeleton.setPosition(1); skeleton.update(); Assert.assertEquals(0, skeleton.getPosition()); Assert.assertEquals(false, skeleton.patrollingLeft); }
@Test public void testUpdateForReverseDirectionFromRightToLeft() { skeleton.patrollingLeft = false; skeleton.setPosition(99); skeleton.update(); Assert.assertEquals(100, skeleton.getPosition()); Assert.assertEquals(true, skeleton.patrollingLeft); }