private static boolean testConvexPolygonArch() { boolean pass = true; int test = 1; int cnt; ConvexPolygon poly; Class cl; Class[] temp; System.out.println("ConvexPolygon architecture tests..."); Point a = new Point(7, 7); Point b = new Point(0, 9); Point c = new Point(-3, -5); Point d = new Point(2, -6); Point e = new Point(12, 0); Point[] vertices = new Point[5]; vertices[0] = new Point(a); vertices[1] = new Point(b); vertices[2] = new Point(c); vertices[3] = new Point(d); vertices[4] = new Point(e); poly = new ConvexPolygon(vertices, Color.cyan, false); cl = poly.getClass(); pass &= test(cl.getConstructors().length == 1, test++); pass &= test((temp = cl.getInterfaces()).length == 1, test++); pass &= test(temp[0].getName().equals("Shape"), test++); pass &= test(verifyEqualsMethodSignature(cl), test++); cnt = countModifiers(cl.getDeclaredMethods(), Modifier.PUBLIC); pass &= test(cnt == 9, test++); cnt = cl.getFields().length; pass &= test(cnt == 0, test++); cnt = countModifiers(cl.getDeclaredFields(), Modifier.PROTECTED); pass &= test(cnt == 0, test++); cnt = countModifiers(cl.getDeclaredFields(), Modifier.PRIVATE); pass &= test(cnt == 3, test++); // Count and test number of of PACKAGE fields cnt = cl.getDeclaredFields().length - countModifiers(cl.getDeclaredFields(), Modifier.PRIVATE) - countModifiers(cl.getDeclaredFields(), Modifier.PROTECTED) - countModifiers(cl.getDeclaredFields(), Modifier.PUBLIC); pass &= test(cnt == 0, test++); return pass; }