[General boards] [Winter 2019 courses] [Fall 2018 courses] [Summer 2018 courses] [Older or newer terms]

A2 setLocation test question


#1

Its been updated in the FAQ for setLocation that getX() returns the colum and getY() returns row. So when testing to see if the fishes are within the boundary, we do
Fish f = new Fish();
f.setLocation(105, 5);
f.setGoingRight(true);
f.update();
assertNotEquals(106, f.getY());

But on a previous post, its been that said the test would be something like


assertNotEquals(106, f.getX()); , I just want to confirm, shouldn’t the 2nd param be
f.getY()?
Thank you


#2

No, that test is making sure the fish doesn’t go off the right side of the fish tank

105 is the rightmost column, we do not want the fish’s column (x coordinate) to be 106, since that would be past the edge. IT should be assertNotEquals(106, f.getX())