got all tests working from the terminal. screw the ide

This commit is contained in:
Greg Gauthier 2023-05-26 19:17:17 +01:00
parent 633e7a059e
commit c209f3d1be
3 changed files with 19 additions and 13 deletions

20
pom.xml
View File

@ -121,13 +121,6 @@
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<version>5.9.3</version>
<scope>test</scope>
</dependency>
</dependencies> </dependencies>
<build> <build>
@ -142,6 +135,19 @@
</pluginManagement> </pluginManagement>
<plugins> <plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.1.0</version>
<configuration>
<includes>
<include>**/CalculatorClientTests.java</include>
<include>**/CalculatorControllerTest.java</include>
</includes>
</configuration>
</plugin>
<plugin> <plugin>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId> <artifactId>spring-boot-maven-plugin</artifactId>

View File

@ -7,7 +7,6 @@ import com.hackerrank.test.utility.OrderedTestRunner;
import org.junit.Before; import org.junit.Before;
import org.junit.Rule; import org.junit.Rule;
import org.junit.Test; import org.junit.Test;
import org.junit.jupiter.api.Assertions;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.context.SpringBootTest;
@ -16,6 +15,7 @@ import java.math.BigDecimal;
import java.net.URISyntaxException; import java.net.URISyntaxException;
import static com.github.tomakehurst.wiremock.client.WireMock.*; import static com.github.tomakehurst.wiremock.client.WireMock.*;
import static org.junit.Assert.assertEquals;
@SpringBootTest @SpringBootTest
@RunWith(OrderedTestRunner.class) @RunWith(OrderedTestRunner.class)
@ -41,7 +41,7 @@ public class CalculatorClientTests {
.withBody("{\"sum\": 4}"))); .withBody("{\"sum\": 4}")));
CalculatorClient calc = new CalculatorClient(); CalculatorClient calc = new CalculatorClient();
Integer resp = calc.getSum(2,2);//two plus two Integer resp = calc.getSum(2,2);//two plus two
Assertions.assertEquals(4, resp.intValue()); assertEquals(4, resp.intValue());
} }
@Test @Test
@ -55,7 +55,7 @@ public class CalculatorClientTests {
.withBody("{\"difference\": 4}"))); .withBody("{\"difference\": 4}")));
CalculatorClient calc = new CalculatorClient(); CalculatorClient calc = new CalculatorClient();
Integer resp = calc.getDifference(6,2); //six minus two Integer resp = calc.getDifference(6,2); //six minus two
Assertions.assertEquals(4, resp.intValue()); assertEquals(4, resp.intValue());
} }
@Test @Test
@ -69,7 +69,7 @@ public class CalculatorClientTests {
.withBody("{\"product\": 4}"))); .withBody("{\"product\": 4}")));
CalculatorClient calc = new CalculatorClient(); CalculatorClient calc = new CalculatorClient();
Integer resp = calc.getProduct(2,2);//two times two Integer resp = calc.getProduct(2,2);//two times two
Assertions.assertEquals(4, resp.intValue()); assertEquals(4, resp.intValue());
} }
@Test @Test
@ -83,6 +83,6 @@ public class CalculatorClientTests {
.withBody("{\"quotient\": 4}"))); .withBody("{\"quotient\": 4}")));
CalculatorClient calc = new CalculatorClient(); CalculatorClient calc = new CalculatorClient();
BigDecimal resp = calc.getQuotient(8,2);//eight divided by two BigDecimal resp = calc.getQuotient(8,2);//eight divided by two
Assertions.assertEquals(BigDecimal.valueOf(4), resp); assertEquals(BigDecimal.valueOf(4), resp);
} }
} }