TorusAgent implements ILocated2D { @Override public double getX() { return x; } TorusAgent(TorusWorld world, int startX, int startY, int type); int getAgentType(); @Override Tuple2D getPosition(); @Override double distance(ILocated2D other); @Override double getX(); @Override double getY(); void move(int dx, int dy); Color getColor(); boolean isCoLocated(TorusAgent other); boolean isCoLocated(TorusAgent[] others); TorusAgent closestAgent(TorusAgent[] others); double[] distances(TorusAgent[] others); double shortestXOffset(TorusAgent torusAgent); double shortestYOffset(TorusAgent torusAgent);  }
@Test public void testGetX() { TorusAgent otherPred = new TorusAgent(new TorusWorld(100, 100), 48, 24, 0); TorusAgent otherPrey = new TorusAgent(new TorusWorld(100, 100), 79, 33, 1); assertEquals(prey.getX(), 0, doubleThreshold); assertEquals(pred.getX(), 0, doubleThreshold); assertEquals(otherPrey.getX(), 79, doubleThreshold); assertEquals(otherPred.getX(), 48, doubleThreshold); }