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
commit 5398b903fb845dd43e4e720998e3ee52e8abd014 Author: Otavio Rodolfo Piske <angusyo...@gmail.com> AuthorDate: Wed May 15 13:33:47 2024 +0200 (chores) camel-test-junit5: duplicated code cleanup --- .../org/apache/camel/test/junit5/CamelTestSupport.java | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/components/camel-test/camel-test-junit5/src/main/java/org/apache/camel/test/junit5/CamelTestSupport.java b/components/camel-test/camel-test-junit5/src/main/java/org/apache/camel/test/junit5/CamelTestSupport.java index 7e4501bc919..d38f7893fae 100644 --- a/components/camel-test/camel-test-junit5/src/main/java/org/apache/camel/test/junit5/CamelTestSupport.java +++ b/components/camel-test/camel-test-junit5/src/main/java/org/apache/camel/test/junit5/CamelTestSupport.java @@ -350,10 +350,7 @@ public abstract class CamelTestSupport createCamelContextPerClass(); } else { // test is per test so always setup - setupResources(); - doPreSetup(); - doSetUp(); - doPostSetup(); + initialize(); } // only start timing after all the setup @@ -370,10 +367,7 @@ public abstract class CamelTestSupport if (v.getAndIncrement() == 0) { LOG.debug("Setup CamelContext before running first test"); // test is per class, so only setup once (the first time) - setupResources(); - doPreSetup(); - doSetUp(); - doPostSetup(); + initialize(); } else { LOG.debug("Reset between test methods"); // and in between tests we must do IoC and reset mocks @@ -382,6 +376,13 @@ public abstract class CamelTestSupport } } + private void initialize() throws Exception { + setupResources(); + doPreSetup(); + doSetUp(); + doPostSetup(); + } + /** * Strategy to perform any pre setup, before {@link CamelContext} is created */