This is an automated email from the ASF dual-hosted git repository. davsclaus pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/master by this push: new 8ca538c CAMEL-13557: Fixed test to use property binding support as the old has removed the legacy JDK PropertyEditor in CAMEL-13566 8ca538c is described below commit 8ca538c49e43ca7ebd984f00d4c3d022c7045224 Author: Claus Ibsen <claus.ib...@gmail.com> AuthorDate: Mon May 27 06:06:34 2019 +0200 CAMEL-13557: Fixed test to use property binding support as the old has removed the legacy JDK PropertyEditor in CAMEL-13566 --- components/camel-wordpress/pom.xml | 5 ----- .../apache/camel/component/wordpress/WordpressEndpoint.java | 2 +- .../camel/component/wordpress/WordpressComponentTest.java | 10 ++++------ 3 files changed, 5 insertions(+), 12 deletions(-) diff --git a/components/camel-wordpress/pom.xml b/components/camel-wordpress/pom.xml index da3457d..6c31625 100644 --- a/components/camel-wordpress/pom.xml +++ b/components/camel-wordpress/pom.xml @@ -83,11 +83,6 @@ <scope>test</scope> </dependency> <dependency> - <groupId>org.mockito</groupId> - <artifactId>mockito-core</artifactId> - <scope>test</scope> - </dependency> - <dependency> <groupId>org.apache.httpcomponents</groupId> <artifactId>httpclient</artifactId> <scope>test</scope> diff --git a/components/camel-wordpress/src/main/java/org/apache/camel/component/wordpress/WordpressEndpoint.java b/components/camel-wordpress/src/main/java/org/apache/camel/component/wordpress/WordpressEndpoint.java index ad039ff..a37f7c8 100644 --- a/components/camel-wordpress/src/main/java/org/apache/camel/component/wordpress/WordpressEndpoint.java +++ b/components/camel-wordpress/src/main/java/org/apache/camel/component/wordpress/WordpressEndpoint.java @@ -126,7 +126,7 @@ public class WordpressEndpoint extends DefaultEndpoint { Map<String, Object> criteriaOptions = IntrospectionSupport.extractProperties(options, "criteria."); // any property that has a "," should be a List criteriaOptions = criteriaOptions.entrySet().stream().collect(Collectors.toMap(Map.Entry::getKey, e -> { - if (e != null && e.toString().indexOf(",") > -1) { + if (e.toString().contains(",")) { return Arrays.asList(e.toString().split(",")); } return e.getValue(); diff --git a/components/camel-wordpress/src/test/java/org/apache/camel/component/wordpress/WordpressComponentTest.java b/components/camel-wordpress/src/test/java/org/apache/camel/component/wordpress/WordpressComponentTest.java index eede318..3643deb 100644 --- a/components/camel-wordpress/src/test/java/org/apache/camel/component/wordpress/WordpressComponentTest.java +++ b/components/camel-wordpress/src/test/java/org/apache/camel/component/wordpress/WordpressComponentTest.java @@ -16,11 +16,10 @@ */ package org.apache.camel.component.wordpress; -import org.apache.camel.CamelContext; import org.apache.camel.component.wordpress.api.model.PostOrderBy; import org.apache.camel.component.wordpress.api.model.PostSearchCriteria; +import org.apache.camel.test.junit4.CamelTestSupport; import org.junit.Test; -import org.mockito.Mockito; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -29,16 +28,15 @@ import static org.hamcrest.CoreMatchers.is; import static org.hamcrest.CoreMatchers.notNullValue; import static org.hamcrest.Matchers.emptyCollectionOf; import static org.hamcrest.Matchers.not; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertThat; -public class WordpressComponentTest { +public class WordpressComponentTest extends CamelTestSupport { private static final Logger LOGGER = LoggerFactory.getLogger(WordpressComponentTest.class); @Test public void testParseUriPropertiesCriteria() throws Exception { - final WordpressComponent component = new WordpressComponent(Mockito.mock(CamelContext.class)); + final WordpressComponent component = new WordpressComponent(context); + final WordpressEndpoint endpoint = (WordpressEndpoint)component .createEndpoint("wordpress:post?apiVersion=2&url=http://mysite.com/&criteria.search=test&criteria.page=1&criteria.perPage=10&criteria.orderBy=author&criteria.categories=camel,dozer,json");