reschke commented on code in PR #226:
URL:
https://github.com/apache/sling-org-apache-sling-resourceresolver/pull/226#discussion_r3729492940
##########
src/test/java/org/apache/sling/resourceresolver/impl/mapping/PagedQueryIteratorTest.java:
##########
@@ -98,14 +108,49 @@ public void testSimpleWrongOrder() {
checkResult(it, expected);
}
+ @Test
+ public void testSimpleWrongType() {
+ try (TestLogger logger =
+
TestLogger.createStartedFor(PagedQueryIterator.class).contains("unexpected")) {
+
+ String[] expected = new String[] {"a", "b", "c"};
+ Collection<Resource> expectedResources = toResourceList(expected);
+
+ Date oneMore = new Date(0);
+ ValueMap properties = new ValueMapDecorator(Map.of(PROPNAME, new
Date[] {oneMore}));
+ Resource r = mock(Resource.class);
+ when(r.getValueMap()).thenReturn(properties);
+
+ expectedResources.add(r);
+
+ when(resourceResolver.findResources(eq("testSimpleWrongType"),
eq("JCR-SQL2")))
+ .thenReturn(expectedResources.iterator());
+ PagedQueryIterator it =
+ new PagedQueryIterator("alias", PROPNAME,
resourceResolver, "testSimpleWrongType", 2000);
+
+ String[] expWithOneMore = Arrays.copyOf(expected, expected.length
+ 1);
+ // implementation detail: this assumes the way Sling converts
Dates to Strings
+ expWithOneMore[expected.length] = oneMore.toInstant().toString();
Review Comment:
good point
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]