Migrate to JUnit5
This commit is contained in:
@ -35,10 +35,16 @@
|
||||
|
||||
<artifactId>throttling</artifactId>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.junit.jupiter</groupId>
|
||||
<artifactId>junit-jupiter-api</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.junit.jupiter</groupId>
|
||||
<artifactId>junit-jupiter-engine</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
@ -22,7 +22,7 @@
|
||||
*/
|
||||
package com.iluwatar.throttling;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
/**
|
||||
* Application test
|
||||
|
@ -22,11 +22,11 @@
|
||||
*/
|
||||
package com.iluwatar.throttling;
|
||||
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
|
||||
import com.iluwatar.throttling.timer.ThrottleTimerImpl;
|
||||
import com.iluwatar.throttling.timer.Throttler;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
|
||||
/**
|
||||
* B2BServiceTest class to test the B2BService
|
||||
@ -43,6 +43,6 @@ public class B2BServiceTest {
|
||||
service.dummyCustomerApi(tenant);
|
||||
}
|
||||
long counter = CallsCount.getCount(tenant.getName());
|
||||
Assert.assertTrue("Counter limit must be reached", counter == 2);
|
||||
assertTrue(counter == 2, "Counter limit must be reached");
|
||||
}
|
||||
}
|
||||
|
@ -22,19 +22,21 @@
|
||||
*/
|
||||
package com.iluwatar.throttling;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import com.iluwatar.throttling.Tenant;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.security.InvalidParameterException;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertThrows;
|
||||
|
||||
/**
|
||||
* TenantTest to test the creation of Tenant with valid parameters.
|
||||
*/
|
||||
public class TenantTest {
|
||||
|
||||
@Test(expected = InvalidParameterException.class)
|
||||
@Test
|
||||
public void constructorTest() {
|
||||
Tenant tenant = new Tenant("FailTenant", -1);
|
||||
assertThrows(InvalidParameterException.class, () -> {
|
||||
Tenant tenant = new Tenant("FailTenant", -1);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user