### Question:
WorldServerMessageFactory extends ServerMessageFactory { public Message generateNewlyVisibleMessage(WorldObject object) { Message newlyVisibleMessage; if (object instanceof Actor) { newlyVisibleMessage = generateActorVisibleMessage((Actor) object); } else { newlyVisibleMessage = generateObjectVisibleMessage(object); } return newlyVisibleMessage; }  Message generateNewlyVisibleMessage(WorldObject object); List<Message> generateChangeStateMessages(Actor changedActor); Message generateForcedStateMessage(MoveState forcedState); Message generateActorMoveSpeedMessage(double moveSpeed); Message generateNewlyInvisibleMessage(WorldObject object); Message generateWorldLoginResponse(); Message generateWorldFileResponse(byte[] worldFileBytes); Message generateWorldChecksumResponse(byte[] checkSum);  }### Answer:
@Test public void testGenerateNewlyVisibleObjectMessage() { WorldObject object = mock(WorldObject.class); when(object.getName()).thenReturn("Foo"); when(object.getVector2D()).thenReturn(Vector2D.ORIGIN); Message message = worldServerMessageFactory.generateNewlyVisibleMessage(object); assertEquals(message.name, "ObjectVisibleMessage"); assertEquals(message.getArgument("name"), "Foo"); }
@Test public void testGenerateNewlyVisibleActorMessage() { Actor actor = mock(Actor.class); when(actor.getName()).thenReturn("Foo"); when(actor.getVector2D()).thenReturn(Vector2D.ORIGIN); when(actor.getAngle()).thenReturn(new Angle()); when(actor.getWorld()).thenReturn(WorldUtils.createDefaultWorld()); Message message = worldServerMessageFactory.generateNewlyVisibleMessage(actor); assertEquals(message.name, "ActorVisibleMessage"); assertEquals(message.getArgument("name"), "Foo"); assertEquals(message.getArgument("relativeAngle"), Angle.IDLE); }