diff --git a/core/pom.xml b/core/pom.xml index 5695ab62b..f27010150 100644 --- a/core/pom.xml +++ b/core/pom.xml @@ -111,9 +111,10 @@ json-path - commons-lang - commons-lang + net.minidev + json-smart + com.google.classpath-explorer classpath-explorer @@ -164,6 +165,14 @@ org.apache.commons commons-collections4 + + org.apache.commons + commons-lang3 + + + org.apache.commons + commons-text + org.jsmart micro-simulator diff --git a/core/src/main/java/org/jsmart/zerocode/core/domain/Parameterized.java b/core/src/main/java/org/jsmart/zerocode/core/domain/Parameterized.java index 91b4b5640..eaac935c3 100644 --- a/core/src/main/java/org/jsmart/zerocode/core/domain/Parameterized.java +++ b/core/src/main/java/org/jsmart/zerocode/core/domain/Parameterized.java @@ -5,7 +5,7 @@ import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectReader; -import org.apache.commons.lang.StringUtils; +import org.apache.commons.lang3.StringUtils; import java.io.IOException; import java.nio.file.Files; diff --git a/core/src/main/java/org/jsmart/zerocode/core/engine/assertion/field/FieldIsOneOfValueAsserter.java b/core/src/main/java/org/jsmart/zerocode/core/engine/assertion/field/FieldIsOneOfValueAsserter.java index 58b4142a5..a93566d14 100644 --- a/core/src/main/java/org/jsmart/zerocode/core/engine/assertion/field/FieldIsOneOfValueAsserter.java +++ b/core/src/main/java/org/jsmart/zerocode/core/engine/assertion/field/FieldIsOneOfValueAsserter.java @@ -6,7 +6,7 @@ import org.jsmart.zerocode.core.engine.assertion.JsonAsserter; import org.jsmart.zerocode.core.engine.assertion.FieldAssertionMatcher; -import static org.apache.commons.lang.StringUtils.substringBetween; +import static org.apache.commons.lang3.StringUtils.substringBetween; public class FieldIsOneOfValueAsserter implements JsonAsserter { private final String path; diff --git a/core/src/main/java/org/jsmart/zerocode/core/engine/executor/httpapi/HttpApiExecutorImpl.java b/core/src/main/java/org/jsmart/zerocode/core/engine/executor/httpapi/HttpApiExecutorImpl.java index dbd5ea286..f54dc6b84 100644 --- a/core/src/main/java/org/jsmart/zerocode/core/engine/executor/httpapi/HttpApiExecutorImpl.java +++ b/core/src/main/java/org/jsmart/zerocode/core/engine/executor/httpapi/HttpApiExecutorImpl.java @@ -16,7 +16,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import static org.apache.commons.lang.StringUtils.isEmpty; +import static org.apache.commons.lang3.StringUtils.isEmpty; import static org.jsmart.zerocode.core.engine.mocker.RestEndPointMocker.createWithLocalMock; import static org.jsmart.zerocode.core.engine.mocker.RestEndPointMocker.createWithVirtuosoMock; import static org.jsmart.zerocode.core.engine.mocker.RestEndPointMocker.createWithWireMock; diff --git a/core/src/main/java/org/jsmart/zerocode/core/engine/mocker/RestEndPointMocker.java b/core/src/main/java/org/jsmart/zerocode/core/engine/mocker/RestEndPointMocker.java index 972ddf885..e6304bcd3 100644 --- a/core/src/main/java/org/jsmart/zerocode/core/engine/mocker/RestEndPointMocker.java +++ b/core/src/main/java/org/jsmart/zerocode/core/engine/mocker/RestEndPointMocker.java @@ -9,8 +9,7 @@ import com.github.tomakehurst.wiremock.extension.responsetemplating.ResponseTemplateTransformer; import com.github.tomakehurst.wiremock.matching.UrlPattern; import org.apache.commons.collections4.map.HashedMap; -import org.apache.commons.lang.StringUtils; -import org.apache.commons.lang3.ObjectUtils; +import org.apache.commons.lang3.StringUtils; import org.jsmart.zerocode.core.domain.MockStep; import org.jsmart.zerocode.core.domain.MockSteps; import org.slf4j.Logger; diff --git a/core/src/main/java/org/jsmart/zerocode/core/engine/preprocessor/ScenarioExecutionState.java b/core/src/main/java/org/jsmart/zerocode/core/engine/preprocessor/ScenarioExecutionState.java index 9576fb305..d88a7b107 100644 --- a/core/src/main/java/org/jsmart/zerocode/core/engine/preprocessor/ScenarioExecutionState.java +++ b/core/src/main/java/org/jsmart/zerocode/core/engine/preprocessor/ScenarioExecutionState.java @@ -1,6 +1,6 @@ package org.jsmart.zerocode.core.engine.preprocessor; -import org.apache.commons.lang.text.StrSubstitutor; +import org.apache.commons.text.StringSubstitutor; import java.util.ArrayList; import java.util.HashMap; @@ -56,6 +56,6 @@ public String getResolvedScenarioState() { final String commaSeparatedStepResults = String.join(", ", getAllStepsInStringList()); paramMap.put("STEP_REQUEST_RESPONSE_SECTION", commaSeparatedStepResults); - return (new StrSubstitutor(paramMap)).replace(scenarioStateTemplate); + return (new StringSubstitutor(paramMap)).replace(scenarioStateTemplate); } } diff --git a/core/src/main/java/org/jsmart/zerocode/core/engine/preprocessor/StepExecutionState.java b/core/src/main/java/org/jsmart/zerocode/core/engine/preprocessor/StepExecutionState.java index 08e0acccc..814b7bd13 100644 --- a/core/src/main/java/org/jsmart/zerocode/core/engine/preprocessor/StepExecutionState.java +++ b/core/src/main/java/org/jsmart/zerocode/core/engine/preprocessor/StepExecutionState.java @@ -1,6 +1,6 @@ package org.jsmart.zerocode.core.engine.preprocessor; -import org.apache.commons.lang.text.StrSubstitutor; +import org.apache.commons.text.StringSubstitutor; import org.jsmart.zerocode.core.domain.Step; import java.util.HashMap; @@ -36,7 +36,7 @@ public void addResponse(String responseJson) { } public String getResolvedStep() { - StrSubstitutor sub = new StrSubstitutor(paramMap); + StringSubstitutor sub = new StringSubstitutor(paramMap); return sub.replace(requestResponseState); } diff --git a/core/src/main/java/org/jsmart/zerocode/core/engine/preprocessor/ZeroCodeAssertionsProcessorImpl.java b/core/src/main/java/org/jsmart/zerocode/core/engine/preprocessor/ZeroCodeAssertionsProcessorImpl.java index 8df167c5a..4a7b46123 100644 --- a/core/src/main/java/org/jsmart/zerocode/core/engine/preprocessor/ZeroCodeAssertionsProcessorImpl.java +++ b/core/src/main/java/org/jsmart/zerocode/core/engine/preprocessor/ZeroCodeAssertionsProcessorImpl.java @@ -9,7 +9,7 @@ import com.google.inject.name.Named; import com.jayway.jsonpath.JsonPath; import net.minidev.json.JSONArray; -import org.apache.commons.lang.text.StrSubstitutor; +import org.apache.commons.text.StringSubstitutor; import org.jsmart.zerocode.core.domain.Step; import org.jsmart.zerocode.core.engine.assertion.FieldAssertionMatcher; import org.jsmart.zerocode.core.engine.assertion.JsonAsserter; @@ -41,11 +41,9 @@ import java.util.List; import java.util.Map; import java.util.Properties; - -import static java.lang.Integer.valueOf; import static java.lang.String.format; -import static org.apache.commons.lang.StringEscapeUtils.escapeJava; -import static org.apache.commons.lang.StringUtils.substringBetween; +import static org.apache.commons.text.StringEscapeUtils.escapeJava; +import static org.apache.commons.lang3.StringUtils.substringBetween; import static org.jsmart.zerocode.core.engine.tokens.ZeroCodeAssertionTokens.ASSERT_LOCAL_DATETIME_AFTER; import static org.jsmart.zerocode.core.engine.tokens.ZeroCodeAssertionTokens.ASSERT_LOCAL_DATETIME_BEFORE; import static org.jsmart.zerocode.core.engine.tokens.ZeroCodeAssertionTokens.ASSERT_PATH_SIZE; @@ -118,7 +116,7 @@ public String resolveKnownTokensAndProperties(String requestJsonOrAnyString) { }); - StrSubstitutor sub = new StrSubstitutor(paramMap); + StringSubstitutor sub = new StringSubstitutor(paramMap); return sub.replace(requestJsonOrAnyString); } @@ -133,7 +131,7 @@ public String resolveJsonPaths(String jsonString, String scenarioState) { try { if (thisPath.endsWith(RAW_BODY)) { - /** + /* * In case the rawBody is used anywhere in the steps as $.step_name.response.rawBody, * then it must be escaped as the content was not a simple JSON string to be able * to convert to json. Hence without throwing exception, treat as string content. @@ -167,7 +165,7 @@ public String resolveJsonPaths(String jsonString, String scenarioState) { } }); - StrSubstitutor sub = new StrSubstitutor(paramMap); + StringSubstitutor sub = new StringSubstitutor(paramMap); return sub.replace(jsonString); } @@ -194,7 +192,6 @@ public List createJsonAsserters(String resolvedAssertionJson) { Map createFieldsKeyValuesMap = createAssertionKV(jsonNode, "$."); - int i = 1; for (Map.Entry entry : createFieldsKeyValuesMap.entrySet()) { String path = entry.getKey(); Object value = entry.getValue(); @@ -216,7 +213,7 @@ public List createJsonAsserters(String resolvedAssertionJson) { } else if (path.endsWith(ASSERT_PATH_SIZE)) { path = path.substring(0, path.length() - ASSERT_PATH_SIZE.length()); if (value instanceof Number) { - asserter = new ArraySizeAsserterImpl(path, ((Integer) value).intValue()); + asserter = new ArraySizeAsserterImpl(path, (Integer) value); } else if (value instanceof String) { asserter = new ArraySizeAsserterImpl(path, (String) value); } else { @@ -378,10 +375,10 @@ public List assertAllAndReturnFailed(List a /** * Resolves JSON.CONTENT as object or array - * + *

* First the logic checks if dig-deep needed to avoid unwanted recursions. If not needed, the step definition is * returned intact. Otherwise calls the dig deep method to perform the operation. - * + *

* returns: The effective step definition */ @Override @@ -433,9 +430,7 @@ private void loadAnnotatedHostProperties() { throw new RuntimeException(msg + e); } - properties.keySet().stream().forEach(thisKey -> { - propertyKeys.add(thisKey.toString()); - }); + properties.keySet().forEach(thisKey -> propertyKeys.add(thisKey.toString())); } private boolean isPropertyKey(String runTimeToken) { @@ -463,7 +458,7 @@ private int findArrayIndex(String thisPath, String actualPath) { if ($VALUE.equals(valueExpr)) { return 0; } - return valueOf(substringBetween(valueExpr, "[", "]")); + return Integer.parseInt(substringBetween(valueExpr, "[", "]")); } private String resolveFieldTypes(String resolvedJson) { @@ -472,7 +467,8 @@ private String resolveFieldTypes(String resolvedJson) { return resolvedJson; } - Map fieldMap = mapper.readValue(resolvedJson, new TypeReference>() { }); + Map fieldMap = mapper.readValue(resolvedJson, new TypeReference>() { + }); deepTypeCast(fieldMap); return mapper.writeValueAsString(fieldMap); @@ -484,8 +480,8 @@ private String resolveFieldTypes(String resolvedJson) { } private boolean hasNoTypeCast(String resolvedJson) { - long foundCount = fieldTypes.stream().filter(thisType -> resolvedJson.contains(thisType)).count(); - return foundCount <= 0 ? true : false; + long foundCount = fieldTypes.stream().filter(resolvedJson::contains).count(); + return foundCount <= 0; } diff --git a/core/src/main/java/org/jsmart/zerocode/core/engine/preprocessor/ZeroCodeParameterizedProcessorImpl.java b/core/src/main/java/org/jsmart/zerocode/core/engine/preprocessor/ZeroCodeParameterizedProcessorImpl.java index a993d63e3..cf4861296 100644 --- a/core/src/main/java/org/jsmart/zerocode/core/engine/preprocessor/ZeroCodeParameterizedProcessorImpl.java +++ b/core/src/main/java/org/jsmart/zerocode/core/engine/preprocessor/ZeroCodeParameterizedProcessorImpl.java @@ -5,7 +5,7 @@ import com.google.inject.Singleton; import com.univocity.parsers.csv.CsvParser; import org.apache.commons.collections4.CollectionUtils; -import org.apache.commons.lang.text.StrSubstitutor; +import org.apache.commons.text.StringSubstitutor; import org.jsmart.zerocode.core.domain.ScenarioSpec; import org.slf4j.Logger; @@ -137,7 +137,7 @@ private void resolveCsvLine(Map valuesMap, String csvLine) { } private String replaceWithValues(String stepJson, Map valuesMap) { - StrSubstitutor sub = new StrSubstitutor(valuesMap); + StringSubstitutor sub = new StringSubstitutor(valuesMap); return sub.replace(stepJson); } diff --git a/core/src/main/java/org/jsmart/zerocode/core/runner/StepNotificationHandler.java b/core/src/main/java/org/jsmart/zerocode/core/runner/StepNotificationHandler.java index 9b619e87a..7b568e3d0 100644 --- a/core/src/main/java/org/jsmart/zerocode/core/runner/StepNotificationHandler.java +++ b/core/src/main/java/org/jsmart/zerocode/core/runner/StepNotificationHandler.java @@ -4,7 +4,7 @@ import java.util.Comparator; import java.util.List; -import org.apache.commons.lang.StringUtils; +import org.apache.commons.lang3.StringUtils; import org.jsmart.zerocode.core.engine.assertion.FieldAssertionMatcher; import org.junit.runner.Description; import org.junit.runner.notification.Failure; diff --git a/core/src/main/java/org/jsmart/zerocode/core/utils/ApiTypeUtils.java b/core/src/main/java/org/jsmart/zerocode/core/utils/ApiTypeUtils.java index bff93fd13..293f62bbd 100644 --- a/core/src/main/java/org/jsmart/zerocode/core/utils/ApiTypeUtils.java +++ b/core/src/main/java/org/jsmart/zerocode/core/utils/ApiTypeUtils.java @@ -4,11 +4,11 @@ import com.google.inject.name.Named; import java.util.Arrays; import java.util.List; -import org.apache.commons.lang.StringUtils; +import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import static org.apache.commons.lang.StringUtils.isEmpty; +import static org.apache.commons.lang3.StringUtils.isEmpty; import static org.jsmart.zerocode.core.constants.ZerocodeConstants.KAFKA; public class ApiTypeUtils { diff --git a/core/src/main/java/org/jsmart/zerocode/core/utils/HelperJsonUtils.java b/core/src/main/java/org/jsmart/zerocode/core/utils/HelperJsonUtils.java index 7f1ccb04b..3d63f64ea 100755 --- a/core/src/main/java/org/jsmart/zerocode/core/utils/HelperJsonUtils.java +++ b/core/src/main/java/org/jsmart/zerocode/core/utils/HelperJsonUtils.java @@ -10,7 +10,7 @@ import java.util.List; import java.util.stream.Collectors; -import org.apache.commons.lang.StringUtils; +import org.apache.commons.lang3.StringUtils; import org.jsmart.zerocode.core.di.provider.ObjectMapperProvider; import org.jsmart.zerocode.core.engine.assertion.FieldAssertionMatcher; import org.slf4j.LoggerFactory; diff --git a/core/src/main/java/org/jsmart/zerocode/core/utils/RunnerUtils.java b/core/src/main/java/org/jsmart/zerocode/core/utils/RunnerUtils.java index 2d25b1c7e..9465182b8 100644 --- a/core/src/main/java/org/jsmart/zerocode/core/utils/RunnerUtils.java +++ b/core/src/main/java/org/jsmart/zerocode/core/utils/RunnerUtils.java @@ -3,7 +3,7 @@ import java.util.HashMap; import java.util.List; import java.util.Map; -import org.apache.commons.lang.StringUtils; +import org.apache.commons.lang3.StringUtils; import org.jsmart.zerocode.core.domain.EnvProperty; import org.jsmart.zerocode.core.domain.Parameterized; import org.jsmart.zerocode.core.domain.Step; diff --git a/core/src/main/java/org/jsmart/zerocode/core/utils/SmartUtils.java b/core/src/main/java/org/jsmart/zerocode/core/utils/SmartUtils.java index 9d1b1b27b..8e8a8e2bc 100644 --- a/core/src/main/java/org/jsmart/zerocode/core/utils/SmartUtils.java +++ b/core/src/main/java/org/jsmart/zerocode/core/utils/SmartUtils.java @@ -14,12 +14,9 @@ import java.io.File; import java.io.IOException; import java.nio.charset.Charset; -import java.nio.charset.StandardCharsets; import java.nio.file.Files; -import java.nio.file.InvalidPathException; import java.nio.file.Path; import java.nio.file.Paths; -import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; import java.util.HashSet; @@ -27,24 +24,16 @@ import java.util.Map; import java.util.Set; import java.util.stream.Collectors; -import org.apache.commons.lang.text.StrSubstitutor; +import org.apache.commons.text.StringSubstitutor; import org.jsmart.zerocode.core.di.provider.ObjectMapperProvider; import org.jsmart.zerocode.core.domain.ScenarioSpec; import org.jsmart.zerocode.core.domain.Step; -import org.jsmart.zerocode.core.engine.assertion.FieldAssertionMatcher; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import static java.nio.charset.Charset.defaultCharset; import static java.nio.charset.StandardCharsets.UTF_8; -import static org.jsmart.zerocode.core.engine.assertion.FieldAssertionMatcher.aMatchingMessage; -import static org.jsmart.zerocode.core.engine.assertion.FieldAssertionMatcher.aNotMatchingMessage; -import static org.jsmart.zerocode.core.engine.tokens.ZeroCodeValueTokens.JSON_PAYLOAD_FILE; -import static org.jsmart.zerocode.core.engine.tokens.ZeroCodeValueTokens.YAML_PAYLOAD_FILE; -import static org.jsmart.zerocode.core.utils.PropertiesProviderUtils.loadAbsoluteProperties; import static org.jsmart.zerocode.core.utils.TokenUtils.getTestCaseTokens; -import static org.skyscreamer.jsonassert.JSONAssert.assertEquals; -import static org.skyscreamer.jsonassert.JSONCompareMode.STRICT; @Singleton public class SmartUtils { @@ -229,7 +218,7 @@ public ObjectMapper getMapper() { } public static String resolveToken(String stringWithToken, Map paramMap) { - StrSubstitutor sub = new StrSubstitutor(paramMap); + StringSubstitutor sub = new StringSubstitutor(paramMap); return sub.replace(stringWithToken); } diff --git a/core/src/main/java/org/jsmart/zerocode/core/utils/TokenUtils.java b/core/src/main/java/org/jsmart/zerocode/core/utils/TokenUtils.java index 367c1ff42..e8ea638e9 100644 --- a/core/src/main/java/org/jsmart/zerocode/core/utils/TokenUtils.java +++ b/core/src/main/java/org/jsmart/zerocode/core/utils/TokenUtils.java @@ -1,7 +1,5 @@ package org.jsmart.zerocode.core.utils; -import org.apache.commons.lang.text.StrSubstitutor; - import java.io.File; import java.net.URL; import java.nio.file.Paths; @@ -16,9 +14,11 @@ import java.util.regex.Matcher; import java.util.regex.Pattern; -import static org.apache.commons.lang.RandomStringUtils.randomAlphabetic; -import static org.apache.commons.lang.RandomStringUtils.randomAlphanumeric; -import static org.apache.commons.lang.StringEscapeUtils.escapeJava; +import org.apache.commons.text.StringSubstitutor; + +import static org.apache.commons.lang3.RandomStringUtils.randomAlphabetic; +import static org.apache.commons.lang3.RandomStringUtils.randomAlphanumeric; +import static org.apache.commons.text.StringEscapeUtils.escapeJava; import static org.jsmart.zerocode.core.engine.tokens.ZeroCodeValueTokens.*; public class TokenUtils { @@ -31,7 +31,7 @@ public static String resolveKnownTokens(String requestJsonOrAnyString) { populateParamMap(paramMap, runTimeToken); }); - StrSubstitutor sub = new StrSubstitutor(paramMap); + StringSubstitutor sub = new StringSubstitutor(paramMap); return sub.replace(requestJsonOrAnyString); } diff --git a/core/src/main/java/org/jsmart/zerocode/core/zzignored/trick/JSON2CSV.java b/core/src/main/java/org/jsmart/zerocode/core/zzignored/trick/JSON2CSV.java index 84d9bccf5..4b50b0ca6 100644 --- a/core/src/main/java/org/jsmart/zerocode/core/zzignored/trick/JSON2CSV.java +++ b/core/src/main/java/org/jsmart/zerocode/core/zzignored/trick/JSON2CSV.java @@ -2,7 +2,7 @@ import java.io.File; import java.io.IOException; - +import java.nio.charset.Charset; import org.apache.commons.io.FileUtils; import org.json.CDL; import org.json.JSONArray; @@ -42,7 +42,7 @@ public static void main(String myHelpers[]){ File file=new File("target/fromJSON.csv"); String csv = CDL.toString(docs); - FileUtils.writeStringToFile(file, csv); + FileUtils.writeStringToFile(file, csv, Charset.defaultCharset()); } catch (JSONException e) { e.printStackTrace(); } catch (IOException e) { diff --git a/core/src/test/java/org/jsmart/zerocode/converter/MimeTypeConverterTest.java b/core/src/test/java/org/jsmart/zerocode/converter/MimeTypeConverterTest.java index 57f7babbb..ba06b4202 100644 --- a/core/src/test/java/org/jsmart/zerocode/converter/MimeTypeConverterTest.java +++ b/core/src/test/java/org/jsmart/zerocode/converter/MimeTypeConverterTest.java @@ -4,12 +4,11 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.jayway.jsonpath.JsonPath; import org.jsmart.zerocode.core.di.provider.ObjectMapperProvider; -import org.junit.Assert; import org.junit.Before; import org.junit.Test; -import static org.apache.commons.lang.StringEscapeUtils.escapeJava; -import static org.apache.commons.lang.StringEscapeUtils.escapeJavaScript; +import static org.apache.commons.text.StringEscapeUtils.escapeJava; +import static org.apache.commons.text.StringEscapeUtils.escapeEcmaScript; import static org.hamcrest.CoreMatchers.containsString; import static org.hamcrest.CoreMatchers.is; import static org.hamcrest.MatcherAssert.assertThat; @@ -29,7 +28,7 @@ public void setUpStuffs() throws Exception { public void testXmlToJsonWithSingleQuote_willNotFail() throws Exception { String xml = "

Street 123
"; - String escapedOut = escapeJavaScript(xml); + String escapedOut = escapeEcmaScript(xml); assertThat(escapedOut, containsString("
Street 123<\\/address>")); escapedOut = escapeJava(xml); diff --git a/core/src/test/java/org/jsmart/zerocode/core/httpclient/ssl/SslTrustHttpClientTest.java b/core/src/test/java/org/jsmart/zerocode/core/httpclient/ssl/SslTrustHttpClientTest.java index c1347efc5..7cd2bcedc 100644 --- a/core/src/test/java/org/jsmart/zerocode/core/httpclient/ssl/SslTrustHttpClientTest.java +++ b/core/src/test/java/org/jsmart/zerocode/core/httpclient/ssl/SslTrustHttpClientTest.java @@ -16,14 +16,14 @@ import org.junit.runner.RunWith; import org.mockito.InjectMocks; import org.mockito.Mock; -import org.mockito.runners.MockitoJUnitRunner; +import org.mockito.junit.MockitoJUnitRunner; import static com.github.tomakehurst.wiremock.client.WireMock.aResponse; import static com.github.tomakehurst.wiremock.client.WireMock.get; import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo; import static org.hamcrest.CoreMatchers.is; import static org.hamcrest.MatcherAssert.assertThat; -import static org.mockito.Matchers.anyObject; +import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; @@ -73,7 +73,7 @@ public static void tearDown() { public void testNulPointerNotThrown_emptyBody() throws Exception { CloseableHttpResponse mockResponse = mock(CloseableHttpResponse.class); HttpUriRequest mockHttpUriRequest = mock(HttpUriRequest.class); - when(httpClient.execute(anyObject())).thenReturn(mockResponse); + when(httpClient.execute(any())).thenReturn(mockResponse); //when(requestBuilder.build()).thenReturn(mockHttpUriRequest); // when(httpClient.execute(anyString(), anyString(), anyMap(), anyMap(), anyObject())) diff --git a/core/src/test/java/org/jsmart/zerocode/core/kafka/helper/KafkaConsumerHelperTest.java b/core/src/test/java/org/jsmart/zerocode/core/kafka/helper/KafkaConsumerHelperTest.java index 63699055c..cf243282a 100644 --- a/core/src/test/java/org/jsmart/zerocode/core/kafka/helper/KafkaConsumerHelperTest.java +++ b/core/src/test/java/org/jsmart/zerocode/core/kafka/helper/KafkaConsumerHelperTest.java @@ -30,7 +30,7 @@ import static org.hamcrest.core.IsNull.nullValue; import static org.jsmart.zerocode.core.kafka.helper.KafkaConsumerHelper.deriveEffectiveConfigs; import static org.jsmart.zerocode.core.kafka.helper.KafkaConsumerHelper.initialPollWaitingForConsumerGroupJoin; -import static org.mockito.Matchers.any; +import static org.mockito.ArgumentMatchers.any; public class KafkaConsumerHelperTest { diff --git a/core/src/test/java/org/jsmart/zerocode/core/utils/FieldTypeConversionUtilsTest.java b/core/src/test/java/org/jsmart/zerocode/core/utils/FieldTypeConversionUtilsTest.java index adb55c8ab..21356bea4 100644 --- a/core/src/test/java/org/jsmart/zerocode/core/utils/FieldTypeConversionUtilsTest.java +++ b/core/src/test/java/org/jsmart/zerocode/core/utils/FieldTypeConversionUtilsTest.java @@ -9,7 +9,7 @@ import java.util.HashMap; import java.util.List; import java.util.Map; -import org.apache.commons.lang.text.StrSubstitutor; +import org.apache.commons.text.StringSubstitutor; import org.jsmart.zerocode.core.di.provider.ObjectMapperProvider; import org.junit.Rule; import org.junit.Test; @@ -85,7 +85,7 @@ public void testSubstituted_v4() throws IOException { paramMap.put(thisPath, pathValue); }); - StrSubstitutor sub = new StrSubstitutor(paramMap); + StringSubstitutor sub = new StringSubstitutor(paramMap); String resolvedJson = sub.replace(jsonViaPath); Map stepMap = mapper.readValue(resolvedJson, new TypeReference>() { @@ -157,7 +157,7 @@ public void testSubstituted_incorrectTypeException() throws IOException { paramMap.put(thisPath, pathValue); }); - StrSubstitutor sub = new StrSubstitutor(paramMap); + StringSubstitutor sub = new StringSubstitutor(paramMap); String resolvedJson = sub.replace(jsonViaPath); Map stepMap = mapper.readValue(resolvedJson, new TypeReference>() { diff --git a/core/src/test/resources/integration_test_files/wiremock_integration/wiremock_with_template.json b/core/src/test/resources/integration_test_files/wiremock_integration/wiremock_with_template.json index 7a3a8996a..7e5612b8c 100644 --- a/core/src/test/resources/integration_test_files/wiremock_integration/wiremock_with_template.json +++ b/core/src/test/resources/integration_test_files/wiremock_integration/wiremock_with_template.json @@ -10,8 +10,8 @@ { "name": "Template 001", "operation": "GET", + "url": "/template/001", "request": { - "urlPath": "/template/001" }, "response": { "status": 200, diff --git a/junit5-testing/src/test/java/org/jsmart/zerocode/jupiter/demo/CalculatorTest.java b/junit5-testing/src/test/java/org/jsmart/zerocode/jupiter/demo/CalculatorTest.java index 0f862383a..0d018352c 100644 --- a/junit5-testing/src/test/java/org/jsmart/zerocode/jupiter/demo/CalculatorTest.java +++ b/junit5-testing/src/test/java/org/jsmart/zerocode/jupiter/demo/CalculatorTest.java @@ -2,7 +2,7 @@ import java.util.HashMap; import java.util.Map; -import org.apache.commons.lang.text.StrSubstitutor; +import org.apache.commons.text.StringSubstitutor; import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; import org.junit.jupiter.params.ParameterizedTest; @@ -56,7 +56,7 @@ void testParamResolver() { Map valuesMap = new HashMap<>(); valuesMap.put("firstName", "Peter"); valuesMap.put("lastName", "Osi"); - StrSubstitutor sub = new StrSubstitutor(valuesMap); + StringSubstitutor sub = new StringSubstitutor(valuesMap); String message = sub.replace(WelcomeMessage); assertEquals("Hello Peter Osi!", message); } diff --git a/pom.xml b/pom.xml index 8cb8ca7f0..28fc070d2 100644 --- a/pom.xml +++ b/pom.xml @@ -70,15 +70,19 @@ 1.0 1.5 7.0.0 - 2.6 - 2.2.0 + 2.9.0 + 2.5.0 3.15.6.Final 1.3.14 2.0.12 - 2.19.0 + + 2.27.2 2.15.0 + 4.4 + 3.14.0 + 1.11.0 1.1.10 4.5.13 4.5.12 @@ -200,10 +204,11 @@ ${jayway-version} - commons-lang - commons-lang - ${commons-lang.version} + net.minidev + json-smart + ${json-smart.version} + com.google.classpath-explorer classpath-explorer @@ -268,7 +273,17 @@ org.apache.commons commons-collections4 - 4.4 + ${commons-collections4.version} + + + org.apache.commons + commons-lang3 + ${commons-lang3.version} + + + org.apache.commons + commons-text + ${commons-text.version} org.jsmart