You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by ro...@apache.org on 2013/10/04 03:05:28 UTC
svn commit: r1529050 -
/sling/trunk/tooling/ide/impl-vlt-test/src/test/java/org/apache/sling/ide/impl/vlt/serialization/ContentXmlHandlerTest.java
Author: rombert
Date: Fri Oct 4 01:05:28 2013
New Revision: 1529050
URL: http://svn.apache.org/r1529050
Log:
SLING-3145 - Compilation error in impl-vlt-test with Java 6
Slight rework of hamcrest matchers to allow compilation to succeed with
javac 6.
Modified:
sling/trunk/tooling/ide/impl-vlt-test/src/test/java/org/apache/sling/ide/impl/vlt/serialization/ContentXmlHandlerTest.java
Modified: sling/trunk/tooling/ide/impl-vlt-test/src/test/java/org/apache/sling/ide/impl/vlt/serialization/ContentXmlHandlerTest.java
URL: http://svn.apache.org/viewvc/sling/trunk/tooling/ide/impl-vlt-test/src/test/java/org/apache/sling/ide/impl/vlt/serialization/ContentXmlHandlerTest.java?rev=1529050&r1=1529049&r2=1529050&view=diff
==============================================================================
--- sling/trunk/tooling/ide/impl-vlt-test/src/test/java/org/apache/sling/ide/impl/vlt/serialization/ContentXmlHandlerTest.java (original)
+++ sling/trunk/tooling/ide/impl-vlt-test/src/test/java/org/apache/sling/ide/impl/vlt/serialization/ContentXmlHandlerTest.java Fri Oct 4 01:05:28 2013
@@ -130,7 +130,7 @@ public class ContentXmlHandlerTest {
ResourceProxy root = parseContentXmlFile("root-content.xml", "/");
- assertThat("root contains /jcr:system", root.getChildren(), hasItem(path("/jcr:system")));
+ assertThat("root contains /jcr:system", root.getChildren(), hasChildPath("/jcr:system"));
}
@Test
@@ -138,14 +138,14 @@ public class ContentXmlHandlerTest {
ResourceProxy root = parseContentXmlFile("encoded-child-content.xml", "/ROOT");
- assertThat("/ROOT contains /_jcr_content", root.getChildren(), hasItem(path("/ROOT/_jcr_content")));
+ assertThat("/ROOT contains /_jcr_content", root.getChildren(), hasChildPath("/ROOT/_jcr_content"));
}
@Test
public void parseContentXmlWithEscapedNames() throws ParserConfigurationException, SAXException, IOException {
ResourceProxy root = parseContentXmlFile("full-coverage-escaped-names.xml", "/");
- assertThat("node contains /50-50", root.getChildren(), hasItem(path("/50-50")));
+ assertThat("node contains /50-50", root.getChildren(), hasChildPath("/50-50"));
}
private static Matcher<Calendar> millis(long millis) {
@@ -153,9 +153,9 @@ public class ContentXmlHandlerTest {
return new CalendarTimeInMillisMatcher(millis);
}
- private static Matcher<ResourceProxy> path(String path) {
+ private static Matcher<Iterable<? extends ResourceProxy>> hasChildPath(String path) {
- return new ResourcePathMatcher(path);
+ return new ResourceChildPathMatcher(path);
}
static class CalendarTimeInMillisMatcher extends TypeSafeMatcher<Calendar> {
@@ -178,11 +178,11 @@ public class ContentXmlHandlerTest {
}
- static class ResourcePathMatcher extends TypeSafeMatcher<ResourceProxy> {
+ static class ResourceChildPathMatcher extends TypeSafeMatcher<Iterable<? extends ResourceProxy>> {
private final String resourcePath;
- private ResourcePathMatcher(String resourcePath) {
+ private ResourceChildPathMatcher(String resourcePath) {
this.resourcePath = resourcePath;
}
@@ -193,8 +193,13 @@ public class ContentXmlHandlerTest {
}
@Override
- protected boolean matchesSafely(ResourceProxy item) {
- return resourcePath.equals(item.getPath());
+ protected boolean matchesSafely(Iterable<? extends ResourceProxy> item) {
+ for (ResourceProxy resource : item) {
+ if (resourcePath.equals(resource.getPath())) {
+ return true;
+ }
+ }
+ return false;
}
}
}