Code example for Collection

Methods: iterator, size

0
        Collection<TestPackage> packages = log.getTestPackages();
        assertEquals(1, packages.size());
        TestPackage pkg = packages.iterator().next();
 
        Collection<Test> tests = pkg.getTests();
        assertNotNull(tests);
        assertEquals(4, tests.size());
        Iterator<Test> iterator = tests.iterator();
        Test test1 = iterator.next();
        assertEquals("android.location.cts.LocationManagerTest#testOne", test1.getFullName());
 
        CtsTestResult result = test1.getResult();
        assertNotNull(result);
        assertEquals("fail", result.getResultString());
        assertNotNull(result.getFailedMessage());
        assertNotNull(result.getStackTrace());
 
        Test test2 = iterator.next();
        Test test3 = iterator.next();
        assertEquals("android.location.cts.AddressTest#testThree", test3.getFullName());