Range { public Range set(int lower, int upper) { this.lower = lower; this.upper = upper; return this; } Range();  Range(int lower, int upper);  Range(Range range); @Override boolean equals(Object o); @Override int hashCode(); int length(); Range set(int lower, int upper); Range set(Range range); Range setEmpty(); boolean isEmpty(); public int lower; public int upper; }
@Test public void testSet_Parameters() throws Exception { Range range = new Range(); range.set(1, 2); assertEquals("lower", 1, range.lower); assertEquals("upper", 2, range.upper); }
@Test public void testSet_Copy() throws Exception { Range original = new Range(1, 2); Range range = new Range(); range.set(original); assertTrue("not the same reference", original != range); assertEquals("lower", 1, range.lower); assertEquals("upper", 2, range.upper); }