jmeter-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fschumac...@apache.org
Subject [jmeter] 02/02: Remove public modifiers from JUnit test class and methods
Date Sat, 18 Sep 2021 12:28:25 GMT
This is an automated email from the ASF dual-hosted git repository.

fschumacher pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/jmeter.git

commit e6b6fa7edea4dc52f34fc3049fe157366c89f33c
Author: Felix Schumacher <felix.schumacher@internetallee.de>
AuthorDate: Sat Sep 18 14:28:11 2021 +0200

    Remove public modifiers from JUnit test class and methods
---
 .../jmeter/functions/TestTimeShiftFunction.java    | 47 +++++++++++-----------
 1 file changed, 24 insertions(+), 23 deletions(-)

diff --git a/src/functions/src/test/java/org/apache/jmeter/functions/TestTimeShiftFunction.java
b/src/functions/src/test/java/org/apache/jmeter/functions/TestTimeShiftFunction.java
index 22c19a2..1587d6b 100644
--- a/src/functions/src/test/java/org/apache/jmeter/functions/TestTimeShiftFunction.java
+++ b/src/functions/src/test/java/org/apache/jmeter/functions/TestTimeShiftFunction.java
@@ -48,7 +48,7 @@ import org.junit.jupiter.api.Assumptions;
 import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.Test;
 
-public class TestTimeShiftFunction extends JMeterTestCase {
+class TestTimeShiftFunction extends JMeterTestCase {
 
     private Function function;
     private SampleResult result;
@@ -57,7 +57,7 @@ public class TestTimeShiftFunction extends JMeterTestCase {
     private String value;
 
     @BeforeEach
-    public void setUp() {
+    void setUp() {
         jmctx = JMeterContextService.getContext();
         vars = new JMeterVariables();
         jmctx.setVariables(vars);
@@ -67,7 +67,7 @@ public class TestTimeShiftFunction extends JMeterTestCase {
     }
 
     @Test
-    public void testDatePlusOneDay() throws Exception {
+    void testDatePlusOneDay() throws Exception {
         Collection<CompoundVariable> params = makeParams("yyyy-dd-MM", "2017-01-01",
"P1D", "");
         function.setParameters(params);
         value = function.execute(result, null);
@@ -75,7 +75,7 @@ public class TestTimeShiftFunction extends JMeterTestCase {
     }
 
     @Test
-    public void testDatePlusOneDayInVariable() throws Exception {
+    void testDatePlusOneDayInVariable() throws Exception {
         Collection<CompoundVariable> params = makeParams("yyyy-dd-MM", "2017-01-01",
"P1d", "VAR");
         function.setParameters(params);
         function.execute(result, null);
@@ -83,7 +83,7 @@ public class TestTimeShiftFunction extends JMeterTestCase {
     }
 
     @Test
-    public void testDatePlusComplexPeriod() throws Exception {
+    void testDatePlusComplexPeriod() throws Exception {
         Collection<CompoundVariable> params = makeParams("yyyy-dd-MM HH:m", "2017-01-01
12:00", "P+32dT-1H-5m", "VAR");
         function.setParameters(params);
         String value = function.execute(result, null);
@@ -91,18 +91,18 @@ public class TestTimeShiftFunction extends JMeterTestCase {
     }
 
     @Test
-    public void testDefault() throws Exception {
+    void testDefault() throws Exception {
         Collection<CompoundVariable> params = makeParams("", "", "", "");
         function.setParameters(params);
         value = function.execute(result, null);
         long resultat = Long.parseLong(value);
-        LocalDateTime  nowFromFunction = LocalDateTime.ofInstant(Instant.ofEpochMilli(resultat),
TimeZone
-                .getDefault().toZoneId());
+        LocalDateTime nowFromFunction = LocalDateTime.ofInstant(Instant.ofEpochMilli(resultat),
+                TimeZone.getDefault().toZoneId());
         assertThat(nowFromFunction, within(5, ChronoUnit.SECONDS, LocalDateTime.now()));
     }
 
     @Test
-    public void testNowPlusOneDay() throws Exception {
+    void testNowPlusOneDay() throws Exception {
         Collection<CompoundVariable> params = makeParams("yyyy-MM-dd", "", "P1d", "");
         function.setParameters(params);
         value = function.execute(result, null);
@@ -112,7 +112,7 @@ public class TestTimeShiftFunction extends JMeterTestCase {
     }
 
     @Test
-    public void testNowWithComplexPeriod() throws Exception {
+    void testNowWithComplexPeriod() throws Exception {
         // Workaround to skip test, when we know it will fail
         // See Bug 65217 and PR 561 for discussions on how to fix the underlying issue
         Assumptions.assumeFalse(dstChangeAhead("P10DT-1H-5M5S"));
@@ -138,8 +138,9 @@ public class TestTimeShiftFunction extends JMeterTestCase {
     }
 
     @Test
-    public void testPotentialBugWithComplexPeriod() throws Exception {
-        Collection<CompoundVariable> params = makeParams("yyyy-MM-dd'T'HH:mm:ss", "2017-12-21T12:00:00",
"P10DT-1H-5M5S", "");
+    void testPotentialBugWithComplexPeriod() throws Exception {
+        Collection<CompoundVariable> params = makeParams("yyyy-MM-dd'T'HH:mm:ss", "2017-12-21T12:00:00",
+                "P10DT-1H-5M5S", "");
         function.setParameters(params);
         value = function.execute(result, null);
         LocalDateTime futureDateFromFunction = LocalDateTime.parse(value);
@@ -166,24 +167,24 @@ public class TestTimeShiftFunction extends JMeterTestCase {
 
     }
 
-    public static void main(String[] args) {
+    static void main(String[] args) {
         System.out.println(java.time.Duration.parse("P10DT-1H-5M5S").toMillis());
     }
 
     @Test
-    public void testWrongAmountToAdd() throws Exception {
+    void testWrongAmountToAdd() throws Exception {
         // Nothing is add with wrong value, so check if return is now
         Collection<CompoundVariable> params = makeParams("", "", "qefv1Psd", "");
         function.setParameters(params);
         value = function.execute(result, null);
         long resultat = Long.parseLong(value);
-        LocalDateTime  nowFromFunction = LocalDateTime.ofInstant(Instant.ofEpochMilli(resultat),
TimeZone
-                .getDefault().toZoneId());
+        LocalDateTime nowFromFunction = LocalDateTime.ofInstant(Instant.ofEpochMilli(resultat),
+                TimeZone.getDefault().toZoneId());
         assertThat(nowFromFunction, within(5, ChronoUnit.SECONDS, LocalDateTime.now()));
     }
 
     @Test
-    public void testWrongFormatDate() throws Exception {
+    void testWrongFormatDate() throws Exception {
         Collection<CompoundVariable> params = makeParams("hjfdjyra:fd", "", "P1D",
"");
         function.setParameters(params);
         value = function.execute(result, null);
@@ -191,26 +192,26 @@ public class TestTimeShiftFunction extends JMeterTestCase {
     }
 
     @Test
-    public void testRandomPeriod() throws Exception {
+    void testRandomPeriod() throws Exception {
         Random r = new Random();
         int randomInt = r.ints(1, 60).limit(1).findFirst().getAsInt();
-        vars.put("random", String.valueOf( randomInt ) );
+        vars.put("random", String.valueOf(randomInt));
         Collection<CompoundVariable> params = makeParams("yyyy-MM-dd'T'HH:mm:ss", "",
"PT${random}M", "");
         function.setParameters(params);
         value = function.execute(result, null);
         LocalDateTime randomFutureDate = LocalDateTime.parse(value);
         LocalDateTime checkFutureDate = LocalDateTime.now().plusMinutes(randomInt);
-        assertThat(randomFutureDate, within(5, ChronoUnit.SECONDS, checkFutureDate) );
+        assertThat(randomFutureDate, within(5, ChronoUnit.SECONDS, checkFutureDate));
         randomInt = r.ints(1, 60).limit(1).findFirst().getAsInt();
-        vars.put("random", String.valueOf( randomInt ) );
+        vars.put("random", String.valueOf(randomInt));
         value = function.execute(result, null);
         randomFutureDate = LocalDateTime.parse(value);
         checkFutureDate = LocalDateTime.now().plusMinutes(randomInt);
-        assertThat(randomFutureDate, within(5, ChronoUnit.SECONDS, checkFutureDate) );
+        assertThat(randomFutureDate, within(5, ChronoUnit.SECONDS, checkFutureDate));
     }
 
     @Test
-    public void testNowPlusOneDayWithLocale() throws Exception {
+    void testNowPlusOneDayWithLocale() throws Exception {
         Collection<CompoundVariable> params = makeParams("yyyy-MMMM-dd", "2017-juillet-01",
"P1D", "fr_FR", "");
         function.setParameters(params);
         value = function.execute(result, null);

Mime
View raw message