Update to JUnit5 across all modules (#1668)

* Updated saga to JUnit 5

* Update fix for CI job in trampoline module

* Updated update-method module to JUnit 5

* Upgraded to latest JUnit Jupiter
JUnit 4 is not needed when using JUnit-Vintage

* Reverted change to access modifier on Trampoline

* Cleanup to resolve code smells

* Formatting

* Formatting

* Migrating to JUnit5 and updating some Mockito patterns

* Migrating to JUnit5

* Migrating to JUnit5

* Migrating to JUnit 5

* Formatting cleanup

* Added missing scope for junit

* Fixed tests that were not running previously.

Co-authored-by: Subhrodip Mohanta <hello@subho.xyz>
This commit is contained in:
CF
2021-03-06 04:12:46 -05:00
committed by GitHub
parent e9d0b3e98c
commit c150871a94
53 changed files with 333 additions and 412 deletions

View File

@ -34,11 +34,6 @@
<artifactId>role-object</artifactId>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>

View File

@ -23,14 +23,14 @@
package com.iluwatar.roleobject;
import org.junit.Test;
import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
public class ApplicationRoleObjectTest {
import org.junit.jupiter.api.Test;
class ApplicationRoleObjectTest {
@Test
public void shouldExecuteApplicationWithoutException() {
void shouldExecuteApplicationWithoutException() {
assertDoesNotThrow(() -> ApplicationRoleObject.main(new String[]{}));
}
}

View File

@ -23,15 +23,16 @@
package com.iluwatar.roleobject;
import org.junit.Assert;
import org.junit.Test;
import static org.junit.jupiter.api.Assertions.assertEquals;
public class BorrowerRoleTest {
import org.junit.jupiter.api.Test;
class BorrowerRoleTest {
@Test
public void borrowTest() {
void borrowTest() {
var borrowerRole = new BorrowerRole();
borrowerRole.setName("test");
Assert.assertEquals(borrowerRole.borrow(), "Borrower test wants to get some money.");
assertEquals("Borrower test wants to get some money.", borrowerRole.borrow());
}
}

View File

@ -23,22 +23,22 @@
package com.iluwatar.roleobject;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertTrue;
import org.junit.Test;
import org.junit.jupiter.api.Test;
public class CustomerCoreTest {
class CustomerCoreTest {
@Test
public void addRole() {
void addRole() {
var core = new CustomerCore();
assertTrue(core.addRole(Role.Borrower));
}
@Test
public void hasRole() {
void hasRole() {
var core = new CustomerCore();
core.addRole(Role.Borrower);
assertTrue(core.hasRole(Role.Borrower));
@ -46,7 +46,7 @@ public class CustomerCoreTest {
}
@Test
public void remRole() {
void remRole() {
var core = new CustomerCore();
core.addRole(Role.Borrower);
@ -60,7 +60,7 @@ public class CustomerCoreTest {
}
@Test
public void getRole() {
void getRole() {
var core = new CustomerCore();
core.addRole(Role.Borrower);
@ -76,17 +76,17 @@ public class CustomerCoreTest {
@Test
public void toStringTest() {
void toStringTest() {
var core = new CustomerCore();
core.addRole(Role.Borrower);
assertEquals(core.toString(), "Customer{roles=[Borrower]}");
assertEquals("Customer{roles=[Borrower]}", core.toString());
core = new CustomerCore();
core.addRole(Role.Investor);
assertEquals(core.toString(), "Customer{roles=[Investor]}");
assertEquals("Customer{roles=[Investor]}", core.toString());
core = new CustomerCore();
assertEquals(core.toString(), "Customer{roles=[]}");
assertEquals("Customer{roles=[]}", core.toString());
}

View File

@ -23,16 +23,17 @@
package com.iluwatar.roleobject;
import org.junit.Assert;
import org.junit.Test;
import static org.junit.jupiter.api.Assertions.assertEquals;
public class InvestorRoleTest {
import org.junit.jupiter.api.Test;
class InvestorRoleTest {
@Test
public void investTest() {
void investTest() {
var investorRole = new InvestorRole();
investorRole.setName("test");
investorRole.setAmountToInvest(10);
Assert.assertEquals(investorRole.invest(), "Investor test has invested 10 dollars");
assertEquals("Investor test has invested 10 dollars", investorRole.invest());
}
}

View File

@ -23,15 +23,17 @@
package com.iluwatar.roleobject;
import org.junit.Assert;
import org.junit.Test;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertTrue;
public class RoleTest {
import org.junit.jupiter.api.Test;
class RoleTest {
@Test
public void instanceTest() {
void instanceTest() {
var instance = Role.Borrower.instance();
Assert.assertTrue(instance.isPresent());
Assert.assertEquals(instance.get().getClass(), BorrowerRole.class);
assertTrue(instance.isPresent());
assertEquals(instance.get().getClass(), BorrowerRole.class);
}
}