Skip to content

Commit

Permalink
upgrading dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
matcdac committed Nov 26, 2023
1 parent 8360ccd commit 1efd425
Show file tree
Hide file tree
Showing 7 changed files with 64 additions and 44 deletions.
63 changes: 43 additions & 20 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,9 @@
<properties>
<jdk.version>11</jdk.version>
<jbehave.version>5.2.0</jbehave.version>
<junit.version>4.13.2</junit.version>
<junit.version>5.10.1</junit.version>
<mockito.version>5.7.0</mockito.version>
<hamcrest.version>2.2</hamcrest.version>
<apache.maven-compiler-plugin.version>3.11.0</apache.maven-compiler-plugin.version>
<apache.maven-source-plugin.version>3.3.0</apache.maven-source-plugin.version>
<apache.maven-javadoc-plugin.version>3.6.2</apache.maven-javadoc-plugin.version>
Expand Down Expand Up @@ -185,37 +186,49 @@
<dependency>
<groupId>org.jbehave</groupId>
<artifactId>jbehave-core</artifactId>
<scope>provided</scope>
<version>${jbehave.version}</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${junit.version}</version>
<groupId>
org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>
${junit.version}</version>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<artifactId>
mockito-core</artifactId>
<version>${mockito.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest</artifactId>
<version>${hamcrest.version}</version>
<scope>test</scope>
</dependency>
</dependencies>

<profiles>
<profile>
<id>sign-artifacts</id>
<id>
sign-artifacts</id>
<activation>
<activeByDefault>false</activeByDefault>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<groupId>
org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<version>${apache.maven-gpg-plugin.version}</version>
<version>
${apache.maven-gpg-plugin.version}</version>
<executions>
<execution>
<id>sign-artifacts</id>
<id>
sign-artifacts</id>
<phase>verify</phase>
<goals>
<goal>sign</goal>
Expand All @@ -227,7 +240,8 @@
</build>
</profile>
<profile>
<id>ci</id>
<id>
ci</id>
<activation>
<property>
<name>env.CI</name>
Expand All @@ -237,23 +251,27 @@
<build>
<plugins>
<plugin>
<groupId>org.jacoco</groupId>
<groupId>
org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>${jacoco.jacoco-maven-plugin.version}</version>
<version>
${jacoco.jacoco-maven-plugin.version}</version>
<executions>
<!-- Prepares the property pointing to the JaCoCo
runtime agent which is passed as VM argument when Maven the Surefire plugin
is executed. -->
<execution>
<id>pre-unit-test</id>
<id>
pre-unit-test</id>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
<!-- Ensures that the code coverage report for
unit tests is created after unit tests have been run. -->
<execution>
<id>post-unit-test</id>
<id>
post-unit-test</id>
<phase>test</phase>
<goals>
<goal>report</goal>
Expand All @@ -262,14 +280,19 @@
</executions>
</plugin>
<plugin>
<groupId>org.eluder.coveralls</groupId>
<groupId>
org.eluder.coveralls</groupId>
<artifactId>coveralls-maven-plugin</artifactId>
<version>${eluder.coveralls-maven-plugin.version}</version>
<version>
${eluder.coveralls-maven-plugin.version}</version>
<dependencies>
<dependency>
<groupId>jakarta.xml.bind</groupId>
<artifactId>jakarta.xml.bind-api</artifactId>
<version>${jakarta.xml.bind-api.version}</version>
<groupId>
jakarta.xml.bind</groupId>
<artifactId>
jakarta.xml.bind-api</artifactId>
<version>
${jakarta.xml.bind-api.version}</version>
</dependency>
</dependencies>
</plugin>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
Expand Down Expand Up @@ -335,8 +336,15 @@ public void shouldCountBeforeScenarioStepWithExampleType() {
private void mockListBeforeOrAfterScenarioCall(ScenarioType... scenarioTypes) {
Method method = new Object(){}.getClass().getEnclosingMethod();
for(ScenarioType scenarioType : scenarioTypes) {
when(steps.listBeforeOrAfterScenario(scenarioType)).thenReturn(
singletonList(new BeforeOrAfterStep(Stage.BEFORE, method, null)));
List<BeforeOrAfterStep> list = singletonList(new BeforeOrAfterStep(method, 1, Outcome.ANY, null));
Map<ScenarioType, List<BeforeOrAfterStep>> map = new HashMap<ScenarioType, List<BeforeOrAfterStep>>();
map.put(scenarioType, list);
when(steps.listBeforeScenario()).thenReturn(map);

list = singletonList(new BeforeOrAfterStep(method, 1, Outcome.ANY, null));
map = new HashMap<ScenarioType, List<BeforeOrAfterStep>>();
map.put(scenarioType, list);
when(steps.listAfterScenario()).thenReturn(map);
}
}

Expand All @@ -359,7 +367,7 @@ private List<Description> createDescriptionFrom(boolean storyAllowed, boolean sc
story.getScenarios());

PerformableStory performableStory = mock(PerformableStory.class);
when(performableStory.isAllowed()).thenReturn(Boolean.valueOf(storyAllowed));
when(performableStory.isExcluded()).thenReturn(Boolean.valueOf(!storyAllowed));
when(performableStory.getStory()).thenReturn(story);
when(performableStory.getScenarios()).thenReturn(performableScenarios);

Expand Down Expand Up @@ -387,7 +395,7 @@ private List<PerformableScenario> mockPerformableScenarios(String storyPath, boo

private PerformableScenario mockPerformableScenario(Scenario scenario, String storyPath, boolean allowed) {
PerformableScenario performableScenario = new PerformableScenario(scenario, storyPath);
performableScenario.allowed(allowed);
performableScenario.excluded(!allowed);
if (scenario.hasExamplesTable()) {
for (Map<String, String> row : scenario.getExamplesTable().getRows()) {
ExamplePerformableScenario exampleScenario = mock(ExamplePerformableScenario.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public static class TestJUnitStory extends JUnitStory {

public static class TestJUnitStories extends JUnitStories {
@Override
protected List<String> storyPaths() {
public List<String> storyPaths() {
return JUNIT_STORIES_PATHS;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public Configuration configuration() {
}

@Override
protected List<String> storyPaths() {
public List<String> storyPaths() {
return Arrays.asList("com/github/TurquoiseSpace/jbehave/junit/monitoring/story/Multiplication.story",
"com/github/TurquoiseSpace/jbehave/junit/monitoring/story/Empty.story");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

import org.jbehave.core.configuration.Configuration;
import org.jbehave.core.i18n.LocalizedKeywords;
import org.jbehave.core.parsers.RegexStoryParser;
import org.junit.runner.RunWith;

@RunWith(JUnitReportingRunner.class)
Expand All @@ -17,17 +16,11 @@ public class ExampleScenarioJUnitStoriesLocalized extends ExampleScenarioJUnitSt

@Override
public Configuration configuration() {
LocalizedKeywords keywords = new LocalizedKeywords(Locale.GERMAN);
Configuration configuration = super.configuration();
RegexStoryParser storyParser = new RegexStoryParser(keywords, configuration.storyLoader(),
configuration.tableTransformers());
return configuration
.useKeywords(keywords)
.useStoryParser(storyParser);
return super.configuration().useKeywords(new LocalizedKeywords(Locale.GERMAN));
}

@Override
protected List<String> storyPaths() {
public List<String> storyPaths() {
return Collections.singletonList("com/github/TurquoiseSpace/jbehave/junit/monitoring/story/Multiplication_de.story");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public InjectableStepsFactory stepsFactory() {
}

@Override
protected List<String> storyPaths() {
public List<String> storyPaths() {
return Collections.singletonList("com/github/TurquoiseSpace/jbehave/junit/monitoring/story/Multiplication.story");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@
import org.jbehave.core.failures.FailingUponPendingStep;
import org.jbehave.core.io.LoadFromClasspath;
import org.jbehave.core.junit.JUnitStories;
import org.jbehave.core.reporters.CrossReference;
import org.jbehave.core.reporters.Format;
import org.jbehave.core.reporters.StoryReporterBuilder;
import org.jbehave.core.steps.DelegatingStepMonitor;
import org.jbehave.core.steps.InjectableStepsFactory;
import org.jbehave.core.steps.InstanceStepsFactory;
import org.jbehave.core.steps.NullStepMonitor;
import org.jbehave.core.steps.ParameterControls;
import org.jbehave.core.steps.StepMonitor;
import org.junit.runner.RunWith;
Expand All @@ -38,19 +38,15 @@ public class StoriesWithAllSortsOfBeforeAndAfter extends JUnitStories {
private final Configuration configuration;

public StoriesWithAllSortsOfBeforeAndAfter() {
CrossReference crossReference = new CrossReference("dummy")
.withJsonOnly().withOutputAfterEachStory(true)
.excludingStoriesWithNoExecutedScenarios(true);
StepMonitor stepMonitor = new DelegatingStepMonitor(
crossReference.getStepMonitor());
new NullStepMonitor());
configuration = new MostUsefulConfiguration()
.useStepMonitor(stepMonitor)
.usePendingStepStrategy(new FailingUponPendingStep())
.useStoryReporterBuilder(
new StoryReporterBuilder().withDefaultFormats()
.withFailureTrace(true)
.withFormats(Format.XML, Format.HTML)
.withCrossReference(crossReference))
.withFormats(Format.XML, Format.HTML))
.useParameterControls(new ParameterControls("<", ">", true));
JUnitReportingRunner.recommendedControls(configuredEmbedder());
}
Expand All @@ -70,7 +66,7 @@ public InjectableStepsFactory stepsFactory() {
}

@Override
protected List<String> storyPaths() {
public List<String> storyPaths() {
return Collections.singletonList(
"com/github/TurquoiseSpace/jbehave/junit/monitoring/story/MultiplicationWithExamplesAndGiven.story");
}
Expand Down

0 comments on commit 1efd425

Please sign in to comment.