Author: sseifert
Date: Mon Oct 10 20:59:09 2016
New Revision: 1764180
URL: http://svn.apache.org/viewvc?rev=1764180&view=rev
Log:
SLING-6117 remove "with"/"has" prefix from ResourceMatchers method names as well
add "path" to resource collection/iterator matchers
Added:
sling/trunk/testing/hamcrest/src/main/java/org/apache/sling/hamcrest/matchers/ResourceCollectionPathMatcher.java
- copied, changed from r1764179,
sling/trunk/testing/hamcrest/src/main/java/org/apache/sling/hamcrest/matchers/ResourceCollectionMatcher.java
sling/trunk/testing/hamcrest/src/main/java/org/apache/sling/hamcrest/matchers/ResourceIteratorPathMatcher.java
- copied, changed from r1764179,
sling/trunk/testing/hamcrest/src/main/java/org/apache/sling/hamcrest/matchers/ResourceIteratorMatcher.java
Removed:
sling/trunk/testing/hamcrest/src/main/java/org/apache/sling/hamcrest/matchers/ResourceCollectionMatcher.java
sling/trunk/testing/hamcrest/src/main/java/org/apache/sling/hamcrest/matchers/ResourceIteratorMatcher.java
Modified:
sling/trunk/contrib/extensions/resourcemerger/src/test/java/org/apache/sling/resourcemerger/impl/CommonMergedResourceProviderTest.java
sling/trunk/testing/hamcrest/src/main/java/org/apache/sling/hamcrest/ResourceCollectionMatchers.java
sling/trunk/testing/hamcrest/src/main/java/org/apache/sling/hamcrest/ResourceIteratorMatchers.java
sling/trunk/testing/hamcrest/src/main/java/org/apache/sling/hamcrest/ResourceMatchers.java
sling/trunk/testing/hamcrest/src/test/java/org/apache/sling/hamcrest/ResourceMatchersTest.java
Modified:
sling/trunk/contrib/extensions/resourcemerger/src/test/java/org/apache/sling/resourcemerger/impl/CommonMergedResourceProviderTest.java
URL:
http://svn.apache.org/viewvc/sling/trunk/contrib/extensions/resourcemerger/src/test/java/org/apache/sling/resourcemerger/impl/CommonMergedResourceProviderTest.java?rev=1764180&r1=1764179&r2=1764180&view=diff
==============================================================================
---
sling/trunk/contrib/extensions/resourcemerger/src/test/java/org/apache/sling/resourcemerger/impl/CommonMergedResourceProviderTest.java
(original)
+++
sling/trunk/contrib/extensions/resourcemerger/src/test/java/org/apache/sling/resourcemerger/impl/CommonMergedResourceProviderTest.java
Mon Oct 10 20:59:09 2016
@@ -133,8 +133,8 @@ public class CommonMergedResourceProvide
// all overlay resource are still exposed, because hiding children by
wildcard only hides children from underlying resources
Assert.assertThat(iterable, Matchers.containsInAnyOrder(
- ResourceMatchers.withNameAndProps("child1",
Collections.singletonMap("property1", (Object)"fromoverlay")),
- ResourceMatchers.withNameAndProps("child3",
Collections.singletonMap("property1", (Object)"fromoverlay"))
+ ResourceMatchers.nameAndProps("child1",
Collections.singletonMap("property1", (Object)"fromoverlay")),
+ ResourceMatchers.nameAndProps("child3",
Collections.singletonMap("property1", (Object)"fromoverlay"))
));
// now hide by explicit value
@@ -144,8 +144,8 @@ public class CommonMergedResourceProvide
// child1 is no longer exposed from overlay, because hiding children
by name hides children from underlying as well as from local resources, child2
is exposed from base
iterable = new IteratorIterable<Resource>(provider.listChildren(ctx,
mergedResource), true);
Assert.assertThat(iterable, Matchers.containsInAnyOrder(
- ResourceMatchers.withName("child2"),
- ResourceMatchers.withName("child3")));
+ ResourceMatchers.name("child2"),
+ ResourceMatchers.name("child3")));
// now hide by negated value (hide all underlying children except for
the one with name child2)
properties.put(MergedResourceConstants.PN_HIDE_CHILDREN, new
String[]{"!child2", "*", "child3"});
@@ -153,8 +153,8 @@ public class CommonMergedResourceProvide
iterable = new IteratorIterable<Resource>(provider.listChildren(ctx,
mergedResource), true);
Assert.assertThat(iterable, Matchers.containsInAnyOrder(
- ResourceMatchers.withName("child2"),
- ResourceMatchers.withNameAndProps("child1",
Collections.singletonMap("property1", (Object)"fromoverlay"))
+ ResourceMatchers.name("child2"),
+ ResourceMatchers.nameAndProps("child1",
Collections.singletonMap("property1", (Object)"fromoverlay"))
));
}
@@ -177,7 +177,7 @@ public class CommonMergedResourceProvide
IteratorIterable<Resource> iterable = new
IteratorIterable<Resource>(provider.listChildren(ctx, mergedResource), true);
// the resource named "!child3" should be hidden
- Assert.assertThat(iterable,
Matchers.contains(ResourceMatchers.withNameAndProps("!child1",
Collections.singletonMap("property1", (Object)"fromoverlay"))));
+ Assert.assertThat(iterable,
Matchers.contains(ResourceMatchers.nameAndProps("!child1",
Collections.singletonMap("property1", (Object)"fromoverlay"))));
}
@Test
@@ -196,7 +196,7 @@ public class CommonMergedResourceProvide
Resource mergedResource = this.provider.getResource(ctx, "/merged",
ResourceContext.EMPTY_CONTEXT, null);
// the child was hidden on the parent (but only for the underlying
resource), the local child from the overlay is still exposed
- Assert.assertThat(provider.getResource(ctx, "/merged/child",
ResourceContext.EMPTY_CONTEXT, mergedResource),
ResourceMatchers.withNameAndProps("child",
Collections.singletonMap("property1", (Object)"fromoverlay")));
+ Assert.assertThat(provider.getResource(ctx, "/merged/child",
ResourceContext.EMPTY_CONTEXT, mergedResource),
ResourceMatchers.nameAndProps("child", Collections.singletonMap("property1",
(Object)"fromoverlay")));
}
@Test
@@ -217,9 +217,9 @@ public class CommonMergedResourceProvide
Resource mergedResource = this.provider.getResource(ctx, "/merged",
ResourceContext.EMPTY_CONTEXT, null);
// property1 is still exposed from overlay, because hiding properties
by wildcard only hides children from underlying resources
- Assert.assertThat(mergedResource,
ResourceMatchers.withProps(expectedProperties));
+ Assert.assertThat(mergedResource,
ResourceMatchers.props(expectedProperties));
// all properties from underlying resource are hidden!
- Assert.assertThat(mergedResource,
Matchers.not(ResourceMatchers.withProps(properties)));
+ Assert.assertThat(mergedResource,
Matchers.not(ResourceMatchers.props(properties)));
// make sure no special properties are exposed
Assert.assertFalse(mergedResource.getValueMap().containsKey(MergedResourceConstants.PN_HIDE_CHILDREN));
Assert.assertFalse(mergedResource.getValueMap().containsKey(MergedResourceConstants.PN_HIDE_PROPERTIES));
@@ -230,9 +230,9 @@ public class CommonMergedResourceProvide
expectedProperties.put("property2", "frombase");
expectedProperties.remove("property1");
// property2 and property 3 are still exposed
- Assert.assertThat(mergedResource,
ResourceMatchers.withProps(expectedProperties));
+ Assert.assertThat(mergedResource,
ResourceMatchers.props(expectedProperties));
// property1 is no longer exposed from overlay nor base, because
hiding properties by name also hides local properties
- Assert.assertThat(mergedResource,
Matchers.not(ResourceMatchers.withProps(Collections.singletonMap("property1",
(Object)"fromoverlay"))));
+ Assert.assertThat(mergedResource,
Matchers.not(ResourceMatchers.props(Collections.singletonMap("property1",
(Object)"fromoverlay"))));
// make sure no special properties are exposed
Assert.assertFalse(mergedResource.getValueMap().containsKey(MergedResourceConstants.PN_HIDE_CHILDREN));
@@ -257,7 +257,7 @@ public class CommonMergedResourceProvide
// convert the iterator returned by list children into an iterable (to
be able to perform some tests)
IteratorIterable<Resource> iterable = new
IteratorIterable<Resource>(provider.listChildren(ctx, mergedResource), true);
- Assert.assertThat(iterable,
Matchers.contains(ResourceMatchers.withName("child1"),ResourceMatchers.withName("child4"),
ResourceMatchers.withName("child2"), ResourceMatchers.withName("child3")));
+ Assert.assertThat(iterable,
Matchers.contains(ResourceMatchers.name("child1"),ResourceMatchers.name("child4"),
ResourceMatchers.name("child2"), ResourceMatchers.name("child3")));
}
@Test
@@ -273,7 +273,7 @@ public class CommonMergedResourceProvide
// convert the iterator returned by list children into an iterable (to
be able to perform some tests)
IteratorIterable<Resource> iterable = new
IteratorIterable<Resource>(provider.listChildren(ctx, mergedResource), true);
- Assert.assertThat(iterable,
Matchers.contains(ResourceMatchers.withName("child1"),ResourceMatchers.withName("child2"),
ResourceMatchers.withName("child3"), ResourceMatchers.withName("child4")));
+ Assert.assertThat(iterable,
Matchers.contains(ResourceMatchers.name("child1"),ResourceMatchers.name("child2"),
ResourceMatchers.name("child3"), ResourceMatchers.name("child4")));
}
@Test
@@ -288,6 +288,6 @@ public class CommonMergedResourceProvide
// convert the iterator returned by list children into an iterable (to
be able to perform some tests)
IteratorIterable<Resource> iterable = new
IteratorIterable<Resource>(provider.listChildren(ctx, mergedResource), true);
- Assert.assertThat(iterable,
Matchers.contains(ResourceMatchers.withName("child1"),ResourceMatchers.withName("child3"),
ResourceMatchers.withName("child2")));
+ Assert.assertThat(iterable,
Matchers.contains(ResourceMatchers.name("child1"),ResourceMatchers.name("child3"),
ResourceMatchers.name("child2")));
}
}
Modified:
sling/trunk/testing/hamcrest/src/main/java/org/apache/sling/hamcrest/ResourceCollectionMatchers.java
URL:
http://svn.apache.org/viewvc/sling/trunk/testing/hamcrest/src/main/java/org/apache/sling/hamcrest/ResourceCollectionMatchers.java?rev=1764180&r1=1764179&r2=1764180&view=diff
==============================================================================
---
sling/trunk/testing/hamcrest/src/main/java/org/apache/sling/hamcrest/ResourceCollectionMatchers.java
(original)
+++
sling/trunk/testing/hamcrest/src/main/java/org/apache/sling/hamcrest/ResourceCollectionMatchers.java
Mon Oct 10 20:59:09 2016
@@ -20,7 +20,7 @@ import java.util.Arrays;
import java.util.Collection;
import org.apache.sling.api.resource.Resource;
-import org.apache.sling.hamcrest.matchers.ResourceCollectionMatcher;
+import org.apache.sling.hamcrest.matchers.ResourceCollectionPathMatcher;
import org.hamcrest.Matcher;
/**
@@ -38,7 +38,7 @@ public final class ResourceCollectionMat
* @return a matcher instance
*/
public static Matcher<Collection<Resource>> paths(String... paths) {
- return new ResourceCollectionMatcher(Arrays.asList(paths));
+ return new ResourceCollectionPathMatcher(Arrays.asList(paths));
}
}
Modified:
sling/trunk/testing/hamcrest/src/main/java/org/apache/sling/hamcrest/ResourceIteratorMatchers.java
URL:
http://svn.apache.org/viewvc/sling/trunk/testing/hamcrest/src/main/java/org/apache/sling/hamcrest/ResourceIteratorMatchers.java?rev=1764180&r1=1764179&r2=1764180&view=diff
==============================================================================
---
sling/trunk/testing/hamcrest/src/main/java/org/apache/sling/hamcrest/ResourceIteratorMatchers.java
(original)
+++
sling/trunk/testing/hamcrest/src/main/java/org/apache/sling/hamcrest/ResourceIteratorMatchers.java
Mon Oct 10 20:59:09 2016
@@ -20,7 +20,7 @@ import java.util.Arrays;
import java.util.Iterator;
import org.apache.sling.api.resource.Resource;
-import org.apache.sling.hamcrest.matchers.ResourceIteratorMatcher;
+import org.apache.sling.hamcrest.matchers.ResourceIteratorPathMatcher;
import org.hamcrest.Matcher;
/**
@@ -38,7 +38,7 @@ public final class ResourceIteratorMatch
* @return a matcher instance
*/
public static Matcher<Iterator<Resource>> paths(String... paths) {
- return new ResourceIteratorMatcher(Arrays.asList(paths));
+ return new ResourceIteratorPathMatcher(Arrays.asList(paths));
}
}
Modified:
sling/trunk/testing/hamcrest/src/main/java/org/apache/sling/hamcrest/ResourceMatchers.java
URL:
http://svn.apache.org/viewvc/sling/trunk/testing/hamcrest/src/main/java/org/apache/sling/hamcrest/ResourceMatchers.java?rev=1764180&r1=1764179&r2=1764180&view=diff
==============================================================================
---
sling/trunk/testing/hamcrest/src/main/java/org/apache/sling/hamcrest/ResourceMatchers.java
(original)
+++
sling/trunk/testing/hamcrest/src/main/java/org/apache/sling/hamcrest/ResourceMatchers.java
Mon Oct 10 20:59:09 2016
@@ -90,7 +90,7 @@ public final class ResourceMatchers {
* @param path the resources path, not <code>null</code> or empty
* @return a matcher instance
*/
- public static Matcher<Resource> withPath(String path) {
+ public static Matcher<Resource> path(String path) {
return new ResourcePathMatcher(path);
}
@@ -104,7 +104,7 @@ public final class ResourceMatchers {
* @param name the resources name, not <code>null</code> or empty
* @return a matcher instance
*/
- public static Matcher<Resource> withName(String name) {
+ public static Matcher<Resource> name(String name) {
return new ResourceNameMatcher(name);
}
@@ -117,7 +117,7 @@ public final class ResourceMatchers {
* @param resourceType the resource type to match
* @return a matcher instance
*/
- public static Matcher<Resource> ofType(String resourceType) {
+ public static Matcher<Resource> resourceType(String resourceType) {
return new ResourcePropertiesMatcher(Collections.<String, Object>
singletonMap(ResourceResolver.PROPERTY_RESOURCE_TYPE, resourceType));
}
@@ -136,7 +136,7 @@ public final class ResourceMatchers {
* @param properties the properties to match
* @return a matcher instance
*/
- public static Matcher<Resource> withProps(Map<String, Object> properties) {
+ public static Matcher<Resource> props(Map<String, Object> properties) {
return new ResourcePropertiesMatcher(properties);
}
@@ -155,8 +155,8 @@ public final class ResourceMatchers {
* @param properties the properties to match
* @return a matcher instance
*/
- public static Matcher<Resource> withProps(Object... properties) {
- return withProps(MapUtil.toMap(properties));
+ public static Matcher<Resource> props(Object... properties) {
+ return props(MapUtil.toMap(properties));
}
/**
@@ -175,7 +175,7 @@ public final class ResourceMatchers {
* @param properties the properties to match
* @return a matcher instance
*/
- public static Matcher<Resource> withNameAndProps(String name, Map<String,
Object> properties) {
+ public static Matcher<Resource> nameAndProps(String name, Map<String,
Object> properties) {
return Matchers.allOf(new ResourceNameMatcher(name), new
ResourcePropertiesMatcher(properties));
}
@@ -195,8 +195,8 @@ public final class ResourceMatchers {
* @param properties the properties to match
* @return a matcher instance
*/
- public static Matcher<Resource> withNameAndProps(String name, Object...
properties) {
- return withNameAndProps(name, MapUtil.toMap(properties));
+ public static Matcher<Resource> nameAndProps(String name, Object...
properties) {
+ return nameAndProps(name, MapUtil.toMap(properties));
}
private ResourceMatchers() {
Copied:
sling/trunk/testing/hamcrest/src/main/java/org/apache/sling/hamcrest/matchers/ResourceCollectionPathMatcher.java
(from r1764179,
sling/trunk/testing/hamcrest/src/main/java/org/apache/sling/hamcrest/matchers/ResourceCollectionMatcher.java)
URL:
http://svn.apache.org/viewvc/sling/trunk/testing/hamcrest/src/main/java/org/apache/sling/hamcrest/matchers/ResourceCollectionPathMatcher.java?p2=sling/trunk/testing/hamcrest/src/main/java/org/apache/sling/hamcrest/matchers/ResourceCollectionPathMatcher.java&p1=sling/trunk/testing/hamcrest/src/main/java/org/apache/sling/hamcrest/matchers/ResourceCollectionMatcher.java&r1=1764179&r2=1764180&rev=1764180&view=diff
==============================================================================
---
sling/trunk/testing/hamcrest/src/main/java/org/apache/sling/hamcrest/matchers/ResourceCollectionMatcher.java
(original)
+++
sling/trunk/testing/hamcrest/src/main/java/org/apache/sling/hamcrest/matchers/ResourceCollectionPathMatcher.java
Mon Oct 10 20:59:09 2016
@@ -28,12 +28,12 @@ import org.hamcrest.TypeSafeMatcher;
/**
* Ensures a collection of resources has exactly the given list of paths in
the given order.
*/
-public class ResourceCollectionMatcher extends
TypeSafeMatcher<Collection<Resource>> {
+public class ResourceCollectionPathMatcher extends
TypeSafeMatcher<Collection<Resource>> {
// this should be "Iterable<? extends Resource>" instead of "?" but cannot
until https://github.com/hamcrest/JavaHamcrest/issues/107 is solved
private final Matcher<?> iterarableMatcher;
- public ResourceCollectionMatcher(List<String> paths) {
+ public ResourceCollectionPathMatcher(List<String> paths) {
if ( paths == null || paths.isEmpty() ) {
throw new IllegalArgumentException("names is null or empty");
}
Copied:
sling/trunk/testing/hamcrest/src/main/java/org/apache/sling/hamcrest/matchers/ResourceIteratorPathMatcher.java
(from r1764179,
sling/trunk/testing/hamcrest/src/main/java/org/apache/sling/hamcrest/matchers/ResourceIteratorMatcher.java)
URL:
http://svn.apache.org/viewvc/sling/trunk/testing/hamcrest/src/main/java/org/apache/sling/hamcrest/matchers/ResourceIteratorPathMatcher.java?p2=sling/trunk/testing/hamcrest/src/main/java/org/apache/sling/hamcrest/matchers/ResourceIteratorPathMatcher.java&p1=sling/trunk/testing/hamcrest/src/main/java/org/apache/sling/hamcrest/matchers/ResourceIteratorMatcher.java&r1=1764179&r2=1764180&rev=1764180&view=diff
==============================================================================
---
sling/trunk/testing/hamcrest/src/main/java/org/apache/sling/hamcrest/matchers/ResourceIteratorMatcher.java
(original)
+++
sling/trunk/testing/hamcrest/src/main/java/org/apache/sling/hamcrest/matchers/ResourceIteratorPathMatcher.java
Mon Oct 10 20:59:09 2016
@@ -28,12 +28,12 @@ import org.hamcrest.TypeSafeMatcher;
/**
* Ensures an iterator of resources has exactly the given list of paths in the
given order.
*/
-public class ResourceIteratorMatcher extends
TypeSafeMatcher<Iterator<Resource>> {
+public class ResourceIteratorPathMatcher extends
TypeSafeMatcher<Iterator<Resource>> {
// this should be "Iterable<? extends Resource>" instead of "?" but cannot
until https://github.com/hamcrest/JavaHamcrest/issues/107 is solved
private final Matcher<?> iterarableMatcher;
- public ResourceIteratorMatcher(List<String> paths) {
+ public ResourceIteratorPathMatcher(List<String> paths) {
if ( paths == null || paths.isEmpty() ) {
throw new IllegalArgumentException("names is null or empty");
}
Modified:
sling/trunk/testing/hamcrest/src/test/java/org/apache/sling/hamcrest/ResourceMatchersTest.java
URL:
http://svn.apache.org/viewvc/sling/trunk/testing/hamcrest/src/test/java/org/apache/sling/hamcrest/ResourceMatchersTest.java?rev=1764180&r1=1764179&r2=1764180&view=diff
==============================================================================
---
sling/trunk/testing/hamcrest/src/test/java/org/apache/sling/hamcrest/ResourceMatchersTest.java
(original)
+++
sling/trunk/testing/hamcrest/src/test/java/org/apache/sling/hamcrest/ResourceMatchersTest.java
Mon Oct 10 20:59:09 2016
@@ -34,36 +34,36 @@ public class ResourceMatchersTest {
public final SlingContext context = new SlingContext();
@Test
- public void testOfType() {
+ public void testResourceType() {
context.build().resource("/resource",
ResourceResolver.PROPERTY_RESOURCE_TYPE, "some/type",
"some other key", "some other value");
Resource resource =
context.resourceResolver().getResource("/resource");
- Assert.assertThat(resource, ResourceMatchers.ofType("some/type"));
- Assert.assertThat(resource,
Matchers.not(ResourceMatchers.ofType("some/other/type")));
+ Assert.assertThat(resource,
ResourceMatchers.resourceType("some/type"));
+ Assert.assertThat(resource,
Matchers.not(ResourceMatchers.resourceType("some/other/type")));
}
@Test
- public void testWithPath() {
+ public void testPath() {
context.build().resource("/resource");
Resource resource =
context.resourceResolver().getResource("/resource");
- Assert.assertThat(resource, ResourceMatchers.withPath("/resource"));
- Assert.assertThat(resource,
Matchers.not(ResourceMatchers.withPath("some/other/name")));
+ Assert.assertThat(resource, ResourceMatchers.path("/resource"));
+ Assert.assertThat(resource,
Matchers.not(ResourceMatchers.path("some/other/name")));
}
@Test
- public void testWithName() {
+ public void testName() {
context.build().resource("/resource");
Resource resource =
context.resourceResolver().getResource("/resource");
- Assert.assertThat(resource, ResourceMatchers.withName("resource"));
- Assert.assertThat(resource,
Matchers.not(ResourceMatchers.withName("some/other/name")));
+ Assert.assertThat(resource, ResourceMatchers.name("resource"));
+ Assert.assertThat(resource,
Matchers.not(ResourceMatchers.name("some/other/name")));
}
@Test
- public void testWithProps() {
+ public void testProps() {
context.build().resource("/resource",
"key1", "value1",
"key2", "value2",
@@ -75,24 +75,24 @@ public class ResourceMatchersTest {
.build();
Resource resource =
context.resourceResolver().getResource("/resource");
- Assert.assertThat(resource,
ResourceMatchers.withProps(expectedProperties));
+ Assert.assertThat(resource,
ResourceMatchers.props(expectedProperties));
// test existing key with not matching value
expectedProperties = ImmutableMap.<String, Object>builder()
.put("key1", "value1")
.put("key2", "value3")
.build();
- Assert.assertThat(resource,
Matchers.not(ResourceMatchers.withProps(expectedProperties)));
+ Assert.assertThat(resource,
Matchers.not(ResourceMatchers.props(expectedProperties)));
// test non-existing key
expectedProperties = ImmutableMap.<String, Object>builder()
.put("key4", "value4")
.build();
- Assert.assertThat(resource,
Matchers.not(ResourceMatchers.withProps(expectedProperties)));
+ Assert.assertThat(resource,
Matchers.not(ResourceMatchers.props(expectedProperties)));
}
@Test
- public void testWithPropsVarargs() {
+ public void testPropsVarargs() {
context.build().resource("/resource",
"key1", "value1",
"key2", "value2",
@@ -104,20 +104,20 @@ public class ResourceMatchersTest {
};
Resource resource =
context.resourceResolver().getResource("/resource");
- Assert.assertThat(resource,
ResourceMatchers.withProps(expectedProperties));
+ Assert.assertThat(resource,
ResourceMatchers.props(expectedProperties));
// test existing key with not matching value
expectedProperties = new Object[] {
"key1", "value1",
"key2", "value3"
};
- Assert.assertThat(resource,
Matchers.not(ResourceMatchers.withProps(expectedProperties)));
+ Assert.assertThat(resource,
Matchers.not(ResourceMatchers.props(expectedProperties)));
// test non-existing key
expectedProperties = new Object[] {
"key4", "value4"
};
- Assert.assertThat(resource,
Matchers.not(ResourceMatchers.withProps(expectedProperties)));
+ Assert.assertThat(resource,
Matchers.not(ResourceMatchers.props(expectedProperties)));
}
@Test
@@ -131,7 +131,7 @@ public class ResourceMatchersTest {
}
@Test
- public void testWithNameAndProps() {
+ public void testNameAndProps() {
context.build().resource("/resource",
"key1", "value1",
"key2", "value2",
@@ -143,21 +143,21 @@ public class ResourceMatchersTest {
.build();
Resource resource =
context.resourceResolver().getResource("/resource");
- Assert.assertThat(resource,
ResourceMatchers.withNameAndProps("resource", expectedProperties));
+ Assert.assertThat(resource, ResourceMatchers.nameAndProps("resource",
expectedProperties));
// test not matching name
- Assert.assertThat(resource,
Matchers.not(ResourceMatchers.withNameAndProps("resource1",
expectedProperties)));
+ Assert.assertThat(resource,
Matchers.not(ResourceMatchers.nameAndProps("resource1", expectedProperties)));
// test existing key with not matching value
expectedProperties = ImmutableMap.<String, Object>builder()
.put("key1", "value1")
.put("key2", "value3")
.build();
- Assert.assertThat(resource,
Matchers.not(ResourceMatchers.withNameAndProps("resource",
expectedProperties)));
+ Assert.assertThat(resource,
Matchers.not(ResourceMatchers.nameAndProps("resource", expectedProperties)));
}
@Test
- public void testWithNameAndPropsVarargs() {
+ public void testNameAndPropsVarargs() {
context.build().resource("/resource",
"key1", "value1",
"key2", "value2",
@@ -169,17 +169,17 @@ public class ResourceMatchersTest {
};
Resource resource =
context.resourceResolver().getResource("/resource");
- Assert.assertThat(resource,
ResourceMatchers.withNameAndProps("resource", expectedProperties));
+ Assert.assertThat(resource, ResourceMatchers.nameAndProps("resource",
expectedProperties));
// test not matching name
- Assert.assertThat(resource,
Matchers.not(ResourceMatchers.withNameAndProps("resource1",
expectedProperties)));
+ Assert.assertThat(resource,
Matchers.not(ResourceMatchers.nameAndProps("resource1", expectedProperties)));
// test existing key with not matching value
expectedProperties = new Object[] {
"key1", "value1",
"key2", "value3"
};
- Assert.assertThat(resource,
Matchers.not(ResourceMatchers.withNameAndProps("resource",
expectedProperties)));
+ Assert.assertThat(resource,
Matchers.not(ResourceMatchers.nameAndProps("resource", expectedProperties)));
}
@Test