diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml index 802054b6d1..82a7373aca 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/gradle.yml @@ -67,11 +67,11 @@ jobs: restore-keys: | tests-history-cache- - - name: Set up JDK 17 + - name: Set up JDK 21 uses: actions/setup-java@v4 with: distribution: 'temurin' - java-version: 17 + java-version: 21 - name: Warm up VIVIDUS test site run: curl https://vividus-test-site-a92k.onrender.com/ & diff --git a/vividus-engine/src/test/java/org/vividus/DryRunAwareExecutorTests.java b/vividus-engine/src/test/java/org/vividus/DryRunAwareExecutorTests.java index 2bd5ba300f..14790178e0 100644 --- a/vividus-engine/src/test/java/org/vividus/DryRunAwareExecutorTests.java +++ b/vividus-engine/src/test/java/org/vividus/DryRunAwareExecutorTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2019-2021 the original author or authors. + * Copyright 2019-2023 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -27,7 +27,10 @@ class DryRunAwareExecutorTests { @ParameterizedTest - @CsvSource(value = {"true, 17", "false, 19"}) + @CsvSource({ + "true, 17", + "false, 19" + }) void shouldReturnCorrectValue(boolean dryRun, int expectedValue) { var storyControls = mock(StoryControls.class); diff --git a/vividus-engine/src/test/java/org/vividus/ExtendedStoryReporterBuilderTests.java b/vividus-engine/src/test/java/org/vividus/ExtendedStoryReporterBuilderTests.java index f2fbee01ad..25e79657c0 100644 --- a/vividus-engine/src/test/java/org/vividus/ExtendedStoryReporterBuilderTests.java +++ b/vividus-engine/src/test/java/org/vividus/ExtendedStoryReporterBuilderTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2019-2021 the original author or authors. + * Copyright 2019-2023 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -34,7 +34,7 @@ void testSetFormats() { List formats = List.of(Format.XML); builder.setFormats(formats); - assertEquals(List.of(org.jbehave.core.reporters.Format.XML), builder.formats()); + assertEquals(List.of(Format.XML), builder.formats()); } @Test diff --git a/vividus-engine/src/test/java/org/vividus/batch/BatchStorageTests.java b/vividus-engine/src/test/java/org/vividus/batch/BatchStorageTests.java index 9c105b2be0..2488b009b4 100644 --- a/vividus-engine/src/test/java/org/vividus/batch/BatchStorageTests.java +++ b/vividus-engine/src/test/java/org/vividus/batch/BatchStorageTests.java @@ -70,7 +70,7 @@ class BatchStorageTests private BatchStorage batchStorage; - void initializeBatchStorage() throws IOException + private void initializeBatchStorage() throws IOException { var batchConfigurations = new HashMap(); addBatchConfiguration(batchConfigurations, 1); diff --git a/vividus-engine/src/test/java/org/vividus/context/RunTestContextTests.java b/vividus-engine/src/test/java/org/vividus/context/RunTestContextTests.java index 96d150fda9..33371c7ee9 100644 --- a/vividus-engine/src/test/java/org/vividus/context/RunTestContextTests.java +++ b/vividus-engine/src/test/java/org/vividus/context/RunTestContextTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2019-2022 the original author or authors. + * Copyright 2019-2023 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -27,7 +27,6 @@ import java.util.LinkedList; import java.util.List; -import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; import org.vividus.model.RunningStory; import org.vividus.testcontext.SimpleTestContext; @@ -56,7 +55,7 @@ void testPutRunningStory() runTestContext.setTestContext(new SimpleTestContext()); RunningStory runningStory = new RunningStory(); runTestContext.putRunningStory(runningStory, false); - Assertions.assertEquals(runningStory, runTestContext.getRunningStory()); + assertEquals(runningStory, runTestContext.getRunningStory()); } @Test @@ -74,7 +73,7 @@ void testPutRunningGivenStory() runTestContext.setTestContext(new SimpleTestContext()); RunningStory runningStory = new RunningStory(); runTestContext.putRunningStory(runningStory, true); - Assertions.assertEquals(runningStory, runTestContext.getRunningStory()); + assertEquals(runningStory, runTestContext.getRunningStory()); } @Test diff --git a/vividus-engine/src/test/java/org/vividus/converter/FluentTrimmedEnumConverterTests.java b/vividus-engine/src/test/java/org/vividus/converter/FluentTrimmedEnumConverterTests.java index 56d62d4b6c..8622efa673 100644 --- a/vividus-engine/src/test/java/org/vividus/converter/FluentTrimmedEnumConverterTests.java +++ b/vividus-engine/src/test/java/org/vividus/converter/FluentTrimmedEnumConverterTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2019-2021 the original author or authors. + * Copyright 2019-2023 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,7 +18,6 @@ import static org.junit.jupiter.api.Assertions.assertEquals; -import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.ValueSource; @@ -33,7 +32,7 @@ class FluentTrimmedEnumConverterTests @ParameterizedTest void testConversion(String valueToConvert) { - Assertions.assertEquals(ComparisonRule.EQUAL_TO, + assertEquals(ComparisonRule.EQUAL_TO, fluentTrimmedEnumConverter.convertValue(valueToConvert, ComparisonRule.class)); } diff --git a/vividus-engine/src/test/java/org/vividus/model/MetaWrapperTests.java b/vividus-engine/src/test/java/org/vividus/model/MetaWrapperTests.java index 90c38309cc..f9fd93a550 100644 --- a/vividus-engine/src/test/java/org/vividus/model/MetaWrapperTests.java +++ b/vividus-engine/src/test/java/org/vividus/model/MetaWrapperTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2019-2021 the original author or authors. + * Copyright 2019-2023 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -46,7 +46,7 @@ void testHasProperty() } @Test - void toTagsTest() + void shouldConvertMetaToTags() { String propertyName = "name2"; List list = List.of("name1=value1", propertyName); diff --git a/vividus-engine/src/test/java/org/vividus/model/jbehave/StoryTests.java b/vividus-engine/src/test/java/org/vividus/model/jbehave/StoryTests.java index 503ab374c3..269dcee306 100644 --- a/vividus-engine/src/test/java/org/vividus/model/jbehave/StoryTests.java +++ b/vividus-engine/src/test/java/org/vividus/model/jbehave/StoryTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2019-2021 the original author or authors. + * Copyright 2019-2023 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -34,6 +34,7 @@ import java.util.List; import java.util.Properties; +import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; @@ -73,7 +74,7 @@ class StoryTests SCENARIO_TITLE, new org.jbehave.core.model.Meta(List.of(META_KEY + StringUtils.SPACE + META_VALUE))); @Test - void shouldDeserializeStoryWithoutExamples() throws Exception + void shouldDeserializeStoryWithoutExamples() throws IOException { performTest((reporter, out) -> { @@ -102,7 +103,7 @@ void shouldDeserializeStoryWithoutExamples() throws Exception } @Test - void shouldDeserializeStoryExamples() throws Exception + void shouldDeserializeStoryExamples() throws IOException { performTest((reporter, out) -> { @@ -233,8 +234,9 @@ private void verifyParameters(Parameters parameters) assertEquals(List.of(List.of(TABLE_VALUE + 1), List.of(TABLE_VALUE + 2)), parameters.getValues()); } - private static void performTest(FailableBiConsumer testables) - throws Exception + private static void performTest( + FailableBiConsumer testables) + throws IOException { try (ByteArrayOutputStream out = new ByteArrayOutputStream(); PrintStream stream = new PrintStream(out, false, StandardCharsets.UTF_8)) diff --git a/vividus-engine/src/test/java/org/vividus/replacement/DeprecatedCompositeStepsReporterTests.java b/vividus-engine/src/test/java/org/vividus/replacement/DeprecatedCompositeStepsReporterTests.java index b854dfb63c..dffa03e69b 100644 --- a/vividus-engine/src/test/java/org/vividus/replacement/DeprecatedCompositeStepsReporterTests.java +++ b/vividus-engine/src/test/java/org/vividus/replacement/DeprecatedCompositeStepsReporterTests.java @@ -51,7 +51,7 @@ class DeprecatedCompositeStepsReporterTests "The step: \"%s\" is deprecated and will be removed in VIVIDUS %s. Use step: \"%s\"", DEPRECATED_STEP_STRING, REMOVE_VERSION, ACTUAL_STEP_STRING); - @Spy private TestContext testContext = new SimpleTestContext(); + @Spy private final TestContext testContext = new SimpleTestContext(); @Mock private LoggingStoryReporter nextReporter; @Mock private DeprecatedStepNotificationFactory deprecatedStepNotificationFactory; @InjectMocks private DeprecatedCompositeStepsReporter deprecatedCompositeStepsReporter; @@ -68,7 +68,7 @@ void shouldResolveCommentInDeprecatedCompositeStep() runBeforeStep(); assertEquals(DEPRECATION_INFO_RESOLVED, testContext.get(DEPRECATED_STEP_NOTIFICATION_KEY)); verify(nextReporter).beforeStep(argThat(s -> s.getExecutionType() == StepExecutionType.COMMENT - && s.getStepAsString().equals(DEPRECATION_INFO_RESOLVED))); + && DEPRECATION_INFO_RESOLVED.equals(s.getStepAsString()))); } @ParameterizedTest diff --git a/vividus-engine/src/test/java/org/vividus/resource/TestResourceLoaderTests.java b/vividus-engine/src/test/java/org/vividus/resource/TestResourceLoaderTests.java index afe4dd6978..0bc5545b22 100644 --- a/vividus-engine/src/test/java/org/vividus/resource/TestResourceLoaderTests.java +++ b/vividus-engine/src/test/java/org/vividus/resource/TestResourceLoaderTests.java @@ -120,7 +120,7 @@ void testGetFileResourcesWithDisabledResourceLoaderConfiguration() throws IOExce var propertyParser = mock(IPropertyParser.class); testResourceLoader = new TestResourceLoader(propertyParser, resourcePatternResolver, false); var resource = mock(Resource.class); - Resource[] expectedResources = new Resource[] { resource }; + Resource[] expectedResources = { resource }; when(resourcePatternResolver.getResources(TABLE_PATH + TABLE_NAME)).thenReturn(expectedResources); var actualResources = testResourceLoader.getResources(TABLE_PATH, TABLE_NAME); diff --git a/vividus-engine/src/test/java/org/vividus/steps/ComparisonRuleTests.java b/vividus-engine/src/test/java/org/vividus/steps/ComparisonRuleTests.java index 3eae6c3061..fc451953e3 100644 --- a/vividus-engine/src/test/java/org/vividus/steps/ComparisonRuleTests.java +++ b/vividus-engine/src/test/java/org/vividus/steps/ComparisonRuleTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2019-2021 the original author or authors. + * Copyright 2019-2023 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -36,7 +36,6 @@ class ComparisonRuleTests { - private static final String INCORRECT_SIGN = "incorrectSign"; private static final int VARIABLE = 42; static Stream getComparisonRule()