}
MockRepositoryPropertyList pl = new MockRepositoryPropertyList(jo);
{
MockRepositoryProperty testProp = pl.getProperty("xyzzy");
MockJcrProperty testJCRProp = new MockJcrProperty(testProp);
Property p = new JcrProperty(testJCRProp);
Value v = p.nextValue();
Assert.assertEquals("skeedle", v.toString());
}
{
MockRepositoryProperty testProp = pl.getProperty("baz");
MockJcrProperty testJCRProp = new MockJcrProperty(testProp);
Property p = new JcrProperty(testJCRProp);
Value v = p.nextValue();
Assert.assertEquals("42", v.toString());
}
{
MockRepositoryProperty testProp = pl.getProperty("abc");
MockJcrProperty testJCRProp = new MockJcrProperty(testProp);
Property p = new JcrProperty(testJCRProp);
int counter = 0;
Value v = null;
while ((v = p.nextValue()) != null) {
String res = v.toString();
switch (counter) {
case 0:
Assert.assertEquals("2", res);
break;
case 1:
Assert.assertEquals("3", res);
break;
case 2:
Assert.assertEquals("5", res);
break;
case 3:
Assert.assertEquals("7", res);
break;
case 4:
Assert.assertEquals("11", res);
break;
}
counter++;
}
Assert.assertEquals(5, counter);
}
{
// TODO: date test
}
{
MockRepositoryProperty testProp = pl.getProperty("ghi");
MockJcrProperty testJCRProp = new MockJcrProperty(testProp);
Property p = new JcrProperty(testJCRProp);
Value v = p.nextValue();
Assert.assertNull(v);
}