Viewport { @Override public String toString() { return "Viewport{" + "x=" + this.x + ", y=" + this.y + ", width=" + this.width + ", height=" + this.height + '}'; } Viewport();  Viewport(int x, int y, int width, int height);  Viewport(Viewport viewport); @Override boolean equals(Object o); @Override int hashCode(); @Override String toString(); Viewport set(int x, int y, int width, int height); Viewport set(Viewport viewport); Viewport setEmpty(); boolean isEmpty(); boolean intersects(int x, int y, int width, int height); @SuppressWarnings("UnnecessaryLocalVariable") boolean intersects(Viewport viewport); boolean intersect(int x, int y, int width, int height); @SuppressWarnings("UnnecessaryLocalVariable") boolean intersect(Viewport viewport); boolean contains(int x, int y); public int x; public int y; public int width; public int height; }
@Test public void testToString() throws Exception { Viewport viewport = new Viewport(1, 2, 3, 4); String string = viewport.toString(); assertTrue("x", string.contains(Integer.toString(viewport.x))); assertTrue("y", string.contains(Integer.toString(viewport.y))); assertTrue("width", string.contains(Integer.toString(viewport.width))); assertTrue("height", string.contains(Integer.toString(viewport.height))); }