You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by or...@apache.org on 2023/07/17 08:29:56 UTC
[camel] branch main updated: CAMEL-19600: camel-atom test code cleanups
This is an automated email from the ASF dual-hosted git repository.
orpiske pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/main by this push:
new c1d9494cad3 CAMEL-19600: camel-atom test code cleanups
c1d9494cad3 is described below
commit c1d9494cad31f5454064053cd4128870ad7ceb95
Author: Nikita Konovalov <nk...@redhat.com>
AuthorDate: Tue Jul 11 16:17:54 2023 +0200
CAMEL-19600: camel-atom test code cleanups
- Deleted redundant variables and declarations
- Simplified assertions
- Used static where possible
- Fixed grammar issues
---
.../java/org/apache/camel/component/atom/AtomGoodBlogsTest.java | 7 +++----
.../camel/component/atom/AtomHttpNoCamelParametersTest.java | 9 +++++----
.../org/apache/camel/component/atom/AtomPollingConsumerTest.java | 2 +-
.../component/atom/AtomPollingConsumerWithBasicAuthTest.java | 2 +-
.../org/apache/camel/component/atom/UpdatedDateFilterTest.java | 7 ++++---
5 files changed, 14 insertions(+), 13 deletions(-)
diff --git a/components/camel-atom/src/test/java/org/apache/camel/component/atom/AtomGoodBlogsTest.java b/components/camel-atom/src/test/java/org/apache/camel/component/atom/AtomGoodBlogsTest.java
index ecefd6ce665..2bca43bc59e 100644
--- a/components/camel-atom/src/test/java/org/apache/camel/component/atom/AtomGoodBlogsTest.java
+++ b/components/camel-atom/src/test/java/org/apache/camel/component/atom/AtomGoodBlogsTest.java
@@ -60,7 +60,7 @@ public class AtomGoodBlogsTest {
return new RouteBuilder() {
public void configure() {
// We pool the atom feeds from the source for further processing in the seda queue
- // we set the delay to 1 second for each pool as this is a unit test also and we can
+ // we set the delay to 1 second for each pool as this is a unit test also, and we can
// not wait the default poll interval of 60 seconds.
// Using splitEntries=true will during polling only fetch one Atom Entry at any given time.
// As the feed.atom file contains 7 entries, using this will require 7 polls to fetch the entire
@@ -108,7 +108,7 @@ public class AtomGoodBlogsTest {
/**
* Services for blogs
*/
- public class BlogService {
+ public static class BlogService {
/**
* Tests the blogs if its a good blog entry or not
@@ -118,8 +118,7 @@ public class AtomGoodBlogsTest {
String title = entry.getTitle();
// We like blogs about Camel
- boolean good = title.toLowerCase().contains("camel");
- return good;
+ return title.toLowerCase().contains("camel");
}
}
diff --git a/components/camel-atom/src/test/java/org/apache/camel/component/atom/AtomHttpNoCamelParametersTest.java b/components/camel-atom/src/test/java/org/apache/camel/component/atom/AtomHttpNoCamelParametersTest.java
index 8cb5b68eb5d..e9618d4ff51 100644
--- a/components/camel-atom/src/test/java/org/apache/camel/component/atom/AtomHttpNoCamelParametersTest.java
+++ b/components/camel-atom/src/test/java/org/apache/camel/component/atom/AtomHttpNoCamelParametersTest.java
@@ -23,6 +23,7 @@ import org.junit.jupiter.api.condition.OS;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
@DisabledOnOs(OS.AIX)
public class AtomHttpNoCamelParametersTest extends CamelTestSupport {
@@ -34,8 +35,8 @@ public class AtomHttpNoCamelParametersTest extends CamelTestSupport {
assertNotNull(atom);
assertEquals("http://www.iafrica.com/pls/cms/grapevine.xml", atom.getFeedUri());
- assertEquals(true, atom.isFeedHeader());
- assertEquals(true, atom.isSortEntries());
+ assertTrue(atom.isFeedHeader());
+ assertTrue(atom.isSortEntries());
}
@Test
@@ -46,8 +47,8 @@ public class AtomHttpNoCamelParametersTest extends CamelTestSupport {
assertNotNull(atom);
assertEquals("http://www.iafrica.com/pls/cms/grapevine.xml?foo=bar", atom.getFeedUri());
- assertEquals(true, atom.isFeedHeader());
- assertEquals(true, atom.isSortEntries());
+ assertTrue(atom.isFeedHeader());
+ assertTrue(atom.isSortEntries());
}
}
diff --git a/components/camel-atom/src/test/java/org/apache/camel/component/atom/AtomPollingConsumerTest.java b/components/camel-atom/src/test/java/org/apache/camel/component/atom/AtomPollingConsumerTest.java
index 89ea366104b..f58e5adaf8a 100644
--- a/components/camel-atom/src/test/java/org/apache/camel/component/atom/AtomPollingConsumerTest.java
+++ b/components/camel-atom/src/test/java/org/apache/camel/component/atom/AtomPollingConsumerTest.java
@@ -76,7 +76,7 @@ public class AtomPollingConsumerTest extends CamelTestSupport {
public void configure() {
from("atom:file:src/test/data/feed.atom?splitEntries=false").to("mock:result");
- // this is a bit weird syntax that normally is not used using the feedUri parameter
+ // this is a bit weird syntax that normally is not using the feedUri parameter
from("atom:?feedUri=file:src/test/data/feed.atom&splitEntries=false").to("mock:result2");
}
};
diff --git a/components/camel-atom/src/test/java/org/apache/camel/component/atom/AtomPollingConsumerWithBasicAuthTest.java b/components/camel-atom/src/test/java/org/apache/camel/component/atom/AtomPollingConsumerWithBasicAuthTest.java
index c936162eeda..8f1d3abadf2 100644
--- a/components/camel-atom/src/test/java/org/apache/camel/component/atom/AtomPollingConsumerWithBasicAuthTest.java
+++ b/components/camel-atom/src/test/java/org/apache/camel/component/atom/AtomPollingConsumerWithBasicAuthTest.java
@@ -50,7 +50,7 @@ public class AtomPollingConsumerWithBasicAuthTest extends AtomPollingConsumerTes
+ "/?splitEntries=false&username=camel&password=camelPass")
.to("mock:result");
- // this is a bit weird syntax that normally is not used using the feedUri parameter
+ // this is a bit weird syntax that normally is not using the feedUri parameter
from("atom:?feedUri=http://localhost:" + PORT
+ "/&splitEntries=false&username=camel&password=camelPass")
.to("mock:result2");
diff --git a/components/camel-atom/src/test/java/org/apache/camel/component/atom/UpdatedDateFilterTest.java b/components/camel-atom/src/test/java/org/apache/camel/component/atom/UpdatedDateFilterTest.java
index d6147ab832c..00eeeb89494 100644
--- a/components/camel-atom/src/test/java/org/apache/camel/component/atom/UpdatedDateFilterTest.java
+++ b/components/camel-atom/src/test/java/org/apache/camel/component/atom/UpdatedDateFilterTest.java
@@ -28,8 +28,9 @@ import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.condition.DisabledOnOs;
import org.junit.jupiter.api.condition.OS;
-import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
/**
* Unit test for UpdatedDateFilter
@@ -56,9 +57,9 @@ public class UpdatedDateFilterTest {
boolean valid = filter.isValidEntry(entry);
// only the 3 last should be true
if (i > 3) {
- assertEquals(false, valid, "not valid");
+ assertFalse(valid, "not valid");
} else {
- assertEquals(true, valid, "valid");
+ assertTrue(valid, "valid");
}
}
}