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-performance-tests.git


The following commit(s) were added to refs/heads/main by this push:
     new 34e6a8e  Add tests for other commonly used methods
34e6a8e is described below

commit 34e6a8eb4992dd88545043e23aafbef49e5b10ba
Author: Otavio Rodolfo Piske <[email protected]>
AuthorDate: Thu Aug 29 15:02:09 2024 +0200

    Add tests for other commonly used methods
---
 .../apache/camel/itest/jmh/StringHelperTest.java   | 28 ++++++++++++++++++++++
 1 file changed, 28 insertions(+)

diff --git 
a/tests/camel-jmh/src/test/java/org/apache/camel/itest/jmh/StringHelperTest.java
 
b/tests/camel-jmh/src/test/java/org/apache/camel/itest/jmh/StringHelperTest.java
index e82ebdc..b3bb2f2 100644
--- 
a/tests/camel-jmh/src/test/java/org/apache/camel/itest/jmh/StringHelperTest.java
+++ 
b/tests/camel-jmh/src/test/java/org/apache/camel/itest/jmh/StringHelperTest.java
@@ -31,6 +31,12 @@ public class StringHelperTest {
 
     private String camelCaseToDashStringToCapitalize = "propertyName";
 
+    private String replaceableText = "part1.secondPart";
+
+    private String sanitazableText = "part1.secondPart://something";
+
+    private String nonSanitazableText = "part1SecondPartSomething";
+
     @Test
     public void launchBenchmark() throws Exception {
         Options opt = new OptionsBuilder()
@@ -147,4 +153,26 @@ public class StringHelperTest {
     public void testCamelCaseToDashNegative(Blackhole bh) {
         
bh.consume(StringHelper.camelCaseToDash(dashStringToCapitalizeNegative));
     }
+
+    @Benchmark
+    @BenchmarkMode(Mode.AverageTime)
+    @OutputTimeUnit(TimeUnit.MICROSECONDS)
+    public void testReplaceFirst(Blackhole bh) {
+        bh.consume(StringHelper.replaceFirst(replaceableText, "part1", 
"firstPart"));
+    }
+
+    @Benchmark
+    @BenchmarkMode(Mode.AverageTime)
+    @OutputTimeUnit(TimeUnit.MICROSECONDS)
+    public void testSanitizeNegative(Blackhole bh) {
+        bh.consume(StringHelper.sanitize(nonSanitazableText));
+    }
+
+    @Benchmark
+    @BenchmarkMode(Mode.AverageTime)
+    @OutputTimeUnit(TimeUnit.MICROSECONDS)
+    public void testSanitizePositive(Blackhole bh) {
+        bh.consume(StringHelper.sanitize(sanitazableText));
+    }
+
 }

Reply via email to