valsIter = this.psi.getValues();
Assert.assertNotNull("Returned Iterator must not be null", valsIter);
Assert.assertTrue("KeyGroupedIterator's value iterator must have another value.", valsIter.hasNext());
rec = valsIter.next();
Assert.assertEquals("KeyGroupedIterator returned a wrong key.", 1, rec.getField(0, IntValue.class).getValue());
Assert.assertEquals("KeyGroupedIterator returned a wrong value.", new StringValue("A"), rec.getField(1, StringValue.class));
Assert.assertFalse("KeyGroupedIterator must have another value.", valsIter.hasNext());
Assert.assertEquals("KeyGroupedIterator returned a wrong key.", 1, rec.getField(0, IntValue.class).getValue());
Assert.assertEquals("KeyGroupedIterator returned a wrong value.", new StringValue("A"), rec.getField(1, StringValue.class));
Assert.assertFalse("KeyGroupedIterator's value iterator must not have another value.", valsIter.hasNext());
Assert.assertTrue("KeyGroupedIterator must have another key.", this.psi.nextKey());
valsIter = this.psi.getValues();
Assert.assertNotNull("Returned Iterator must not be null", valsIter);
Assert.assertTrue("KeyGroupedIterator's value iterator must have another value.", valsIter.hasNext());
rec = valsIter.next();
Assert.assertEquals("KeyGroupedIterator returned a wrong key.", 2, rec.getField(0, IntValue.class).getValue());
Assert.assertEquals("KeyGroupedIterator returned a wrong value.", new StringValue("B"), rec.getField(1, StringValue.class));
Assert.assertFalse("KeyGroupedIterator must have another value.", valsIter.hasNext());
Assert.assertEquals("KeyGroupedIterator returned a wrong key.", 2, rec.getField(0, IntValue.class).getValue());
Assert.assertEquals("KeyGroupedIterator returned a wrong value.", new StringValue("B"), rec.getField(1, StringValue.class));
Assert.assertFalse("KeyGroupedIterator's value iterator must not have another value.", valsIter.hasNext());
Assert.assertTrue("KeyGroupedIterator must have another key.", this.psi.nextKey());
valsIter = this.psi.getValues();
Assert.assertNotNull("Returned Iterator must not be null", valsIter);
Assert.assertTrue("KeyGroupedIterator's value iterator must have another value.", valsIter.hasNext());
rec = valsIter.next();
Assert.assertEquals("KeyGroupedIterator returned a wrong key.", 3, rec.getField(0, IntValue.class).getValue());
Assert.assertEquals("KeyGroupedIterator returned a wrong value.", new StringValue("C"), rec.getField(1, StringValue.class));
Assert.assertTrue("KeyGroupedIterator's value iterator must have another value.", valsIter.hasNext());
Assert.assertEquals("KeyGroupedIterator returned a wrong key.", 3, rec.getField(0, IntValue.class).getValue());
Assert.assertEquals("KeyGroupedIterator returned a wrong value.", new StringValue("C"), rec.getField(1, StringValue.class));
rec = valsIter.next();
Assert.assertEquals("KeyGroupedIterator returned a wrong key.", 3, rec.getField(0, IntValue.class).getValue());
Assert.assertEquals("KeyGroupedIterator returned a wrong value.", new StringValue("D"), rec.getField(1, StringValue.class));
Assert.assertFalse("KeyGroupedIterator's value iterator must have another value.", valsIter.hasNext());
Assert.assertEquals("KeyGroupedIterator returned a wrong key.", 3, rec.getField(0, IntValue.class).getValue());
Assert.assertEquals("KeyGroupedIterator returned a wrong value.", new StringValue("D"), rec.getField(1, StringValue.class));
Assert.assertFalse("KeyGroupedIterator's value iterator must have another value.", valsIter.hasNext());
Assert.assertEquals("KeyGroupedIterator returned a wrong key.", 3, rec.getField(0, IntValue.class).getValue());
Assert.assertEquals("KeyGroupedIterator returned a wrong value.", new StringValue("D"), rec.getField(1, StringValue.class));
} catch (Exception e) {
e.printStackTrace();
Assert.fail("The test encountered an unexpected exception.");
}
}