I have a project in my programming class and I'm failing a test case. I look into the test driver and find this:
private static boolean testSquareArch()
{
boolean pass = true;
int test = 1;
int cnt;
Square sq;
Class cl;
System.out.println("Square architecture tests...");
sq = new Square(true, true, true, true, 0, 0);
cl = sq.getClass();
cnt = cl.getFields().length;
pass &= test(cnt == 5, test++); //FAILING THIS TEST
What does this do and how does it check my code?
Also while I'm here, what does this do?
// 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 == 5, test++); // Test 8
I'm failing these test cases and just want to know why. Thanks