I'm currently working on updating my WireMock work...
# wiremock-java
b
I'm currently working on updating my WireMock workshop (https://github.com/basdijkstra/wiremock-workshop), and I'd like to use WireMock 4 in the next version. The latest beta
4.0.0-beta.15
does not play nice with JUnit 6 yet, is that because of this one still being open? https://github.com/wiremock/wiremock/pull/3174. If I change to JUnit
5.13.4
everything works fine. If that PR is supposed to fix this I'll be patient 🙂
t
Thanks for pointing this out Bas. We haven’t had any time to look at JUnit 6 compatibility yet (we’re up against it with customer commitments for the moment), but clearly this is very important so we’ll take a look as soon as there’s a break available.
b
No problem, thanks for the response!
👍 1
t
@Bas Dijkstra looking at JUnit 6 compat now. JUnit 5 tests all pass apart from two when I bump to 6.0.0 of JUnit so I’m wondering what problems you encountered when you tried it? If I take your workshop project and bump the JUnit version will that reproduce the failure?
b
Yeah I think that’s where I ran into the issue
t
OK, I’ll try that. Currently the only problem I’m seeing is quite niche - getting wrong port numbers when using @Nested test classes.
I’m seeing exactly the same results when I switch your project to JUnit 6.0.1. I did have to add a couple of dependencies to make the Maven build run the tests properly. This is what my
pom.xml
looks like now:
Copy code
<project xmlns="<http://maven.apache.org/POM/4.0.0>" xmlns:xsi="<http://www.w3.org/2001/XMLSchema-instance>"
	xsi:schemaLocation="<http://maven.apache.org/POM/4.0.0> <http://maven.apache.org/xsd/maven-4.0.0.xsd>">
	<modelVersion>4.0.0</modelVersion>
	<groupId>com.ontestautomation.workshops.wiremock</groupId>
	<artifactId>wiremock-workshop</artifactId>
	<version>1.0.0</version>
	<description>Project containing examples, exercises and answers for my open source WireMock workshop</description>
	<properties>
		<maven.compiler.release>17</maven.compiler.release>
		<wiremock.version>4.0.0-beta.15</wiremock.version>
		<junit.version>6.0.1</junit.version>
		<restassured.version>5.5.6</restassured.version>
		<slf4j.version>2.0.17</slf4j.version>
		<maven.surefire.plugin.version>3.5.4</maven.surefire.plugin.version>
	</properties>
	<dependencies>
		<dependency>
			<groupId>org.wiremock</groupId>
			<artifactId>wiremock</artifactId>
			<version>${wiremock.version}</version>
			<scope>test</scope>
		</dependency>
		<dependency>
			<groupId>org.junit.jupiter</groupId>
			<artifactId>junit-jupiter-engine</artifactId>
			<version>${junit.version}</version>
			<scope>test</scope>
		</dependency>
		<dependency>
			<groupId>org.junit.jupiter</groupId>
			<artifactId>junit-jupiter-params</artifactId>
			<version>${junit.version}</version>
			<scope>test</scope>
		</dependency>
		<dependency>
			<groupId>org.junit.platform</groupId>
			<artifactId>junit-platform-launcher</artifactId>
			<version>${junit.version}</version>
			<scope>test</scope>
		</dependency>
		<dependency>
			<groupId>org.junit.platform</groupId>
			<artifactId>junit-platform-commons</artifactId>
			<version>${junit.version}</version>
			<scope>test</scope>
		</dependency>
		<dependency>
			<groupId>io.rest-assured</groupId>
			<artifactId>rest-assured</artifactId>
			<version>${restassured.version}</version>
			<scope>test</scope>
		</dependency>
		<dependency>
			<groupId>org.slf4j</groupId>
			<artifactId>slf4j-nop</artifactId>
			<version>${slf4j.version}</version>
			<scope>test</scope>
		</dependency>
	</dependencies>
	<build>
		<plugins>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-compiler-plugin</artifactId>
				<version>3.13.0</version>
				<configuration>
					<release>${maven.compiler.release}</release>
				</configuration>
			</plugin>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-surefire-plugin</artifactId>
				<version>${maven.surefire.plugin.version}</version>
			</plugin>
		</plugins>
	</build>
</project>
b
Thanks! I’ll have a look tonight and see if I can make it work, too
t
Some tests were failing - I’m not sure if this was by design or not. But the same ones were failing regardless of the JUnit version, it seemed.
b
Yes, the exercises are basically in the ‘write the mock to make the test pass’ format, this is by design :)
That did the trick, thank you very much, @Tom!
👍 1