@Test public void getEntity_null() throws Exception { assertEquals(entityFactory.getEntity(null), null); }
public Entity getEntity(DrawEntityCommand command) { if (command instanceof DrawLineCommand) { DrawLineCommand cmd = (DrawLineCommand) command; return new Line(cmd.getX1(), cmd.getY1(), cmd.getX2(), cmd.getY2()); } else if (command instanceof DrawRectangleCommand) { DrawRectangleCommand cmd = (DrawRectangleCommand) command; return new Rectangle(cmd.getX1(), cmd.getY1(), cmd.getX2(), cmd.getY2()); } else if (command instanceof BucketFillCommand) { BucketFillCommand cmd = (BucketFillCommand) command; return new BucketFill(cmd.getX(), cmd.getY(), cmd.getCharacter()); } return null; }
EntityFactory { public Entity getEntity(DrawEntityCommand command) { if (command instanceof DrawLineCommand) { DrawLineCommand cmd = (DrawLineCommand) command; return new Line(cmd.getX1(), cmd.getY1(), cmd.getX2(), cmd.getY2()); } else if (command instanceof DrawRectangleCommand) { DrawRectangleCommand cmd = (DrawRectangleCommand) command; return new Rectangle(cmd.getX1(), cmd.getY1(), cmd.getX2(), cmd.getY2()); } else if (command instanceof BucketFillCommand) { BucketFillCommand cmd = (BucketFillCommand) command; return new BucketFill(cmd.getX(), cmd.getY(), cmd.getCharacter()); } return null; } }
EntityFactory { public Entity getEntity(DrawEntityCommand command) { if (command instanceof DrawLineCommand) { DrawLineCommand cmd = (DrawLineCommand) command; return new Line(cmd.getX1(), cmd.getY1(), cmd.getX2(), cmd.getY2()); } else if (command instanceof DrawRectangleCommand) { DrawRectangleCommand cmd = (DrawRectangleCommand) command; return new Rectangle(cmd.getX1(), cmd.getY1(), cmd.getX2(), cmd.getY2()); } else if (command instanceof BucketFillCommand) { BucketFillCommand cmd = (BucketFillCommand) command; return new BucketFill(cmd.getX(), cmd.getY(), cmd.getCharacter()); } return null; }  }
EntityFactory { public Entity getEntity(DrawEntityCommand command) { if (command instanceof DrawLineCommand) { DrawLineCommand cmd = (DrawLineCommand) command; return new Line(cmd.getX1(), cmd.getY1(), cmd.getX2(), cmd.getY2()); } else if (command instanceof DrawRectangleCommand) { DrawRectangleCommand cmd = (DrawRectangleCommand) command; return new Rectangle(cmd.getX1(), cmd.getY1(), cmd.getX2(), cmd.getY2()); } else if (command instanceof BucketFillCommand) { BucketFillCommand cmd = (BucketFillCommand) command; return new BucketFill(cmd.getX(), cmd.getY(), cmd.getCharacter()); } return null; }  Entity getEntity(DrawEntityCommand command); }
EntityFactory { public Entity getEntity(DrawEntityCommand command) { if (command instanceof DrawLineCommand) { DrawLineCommand cmd = (DrawLineCommand) command; return new Line(cmd.getX1(), cmd.getY1(), cmd.getX2(), cmd.getY2()); } else if (command instanceof DrawRectangleCommand) { DrawRectangleCommand cmd = (DrawRectangleCommand) command; return new Rectangle(cmd.getX1(), cmd.getY1(), cmd.getX2(), cmd.getY2()); } else if (command instanceof BucketFillCommand) { BucketFillCommand cmd = (BucketFillCommand) command; return new BucketFill(cmd.getX(), cmd.getY(), cmd.getCharacter()); } return null; }  Entity getEntity(DrawEntityCommand command);  }