@Test public void testNullifyImages() { PwFloor floor1 = (new Gson()).fromJson(floor_2_resources, PwFloor.class); floor1.nullifyImages(); ArrayList<PwFloorResource> floorResourceArrayList = floor1.getResources(); for (PwFloorResource floorResource : floorResourceArrayList) { assertNull(floorResource.getPicture()); } }
@Test public void testParcelable() { PwFloor floor1 = (new Gson()).fromJson(floor_2_resources, PwFloor.class); final Parcel parcel = Parcel.obtain(); floor1.writeToParcel(parcel, 0); PwFloor floor2 = new PwFloor(parcel); assertEquals(floor1, floor2); }
@Test public void testCompareTo() { PwCoordinateSpace coordinateSpace = new PwCoordinateSpace(200f, 400f); coordinateSpace.setImageHeight(200f); coordinateSpace.setImageWidth(100f); PwFloor floor1 = new PwFloor(100, 1, "First Floor", coordinateSpace, 123L); PwFloor floor2 = new PwFloor(200, 2, "Second Floor", coordinateSpace, 124L); assertEquals(-1, floor1.compareTo(floor2)); assertEquals(1, floor2.compareTo(floor1)); assertEquals(0, floor1.compareTo(floor1)); assertEquals(1, floor1.compareTo(null)); }
@Test public void testHash() { PwFloor floor1 = (new Gson()).fromJson(floor_2_resources, PwFloor.class); PwFloor floor2 = (new Gson()).fromJson(floor_3_resources, PwFloor.class); PwFloor floor3 = (new Gson()).fromJson(floor_2_resources, PwFloor.class); assertEquals(floor1.hashCode(), floor1.hashCode()); assertNotEquals(floor1.hashCode(), floor2.hashCode()); assertNotEquals(floor2.hashCode(), floor1.hashCode()); assertEquals(floor2.hashCode(), floor2.hashCode()); assertEquals(floor1.hashCode(), floor3.hashCode()); }