Migrate to JUnit5
This commit is contained in:
@ -34,8 +34,13 @@
|
||||
<artifactId>lazy-loading</artifactId>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<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>
|
||||
|
@ -22,11 +22,13 @@
|
||||
*/
|
||||
package com.iluwatar.lazy.loading;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import static junit.framework.Assert.assertNotNull;
|
||||
import static junit.framework.Assert.assertSame;
|
||||
import static junit.framework.TestCase.assertNull;
|
||||
import static java.time.Duration.ofMillis;
|
||||
import static org.junit.jupiter.api.Assertions.assertNotNull;
|
||||
import static org.junit.jupiter.api.Assertions.assertNull;
|
||||
import static org.junit.jupiter.api.Assertions.assertSame;
|
||||
import static org.junit.jupiter.api.Assertions.assertTimeout;
|
||||
|
||||
/**
|
||||
* Date: 12/19/15 - 11:58 AM
|
||||
@ -52,12 +54,14 @@ public abstract class AbstractHolderTest {
|
||||
/**
|
||||
* This test shows that the heavy field is not instantiated until the method getHeavy is called
|
||||
*/
|
||||
@Test(timeout = 3000)
|
||||
@Test
|
||||
public void testGetHeavy() throws Exception {
|
||||
assertNull(getInternalHeavyValue());
|
||||
assertNotNull(getHeavy());
|
||||
assertNotNull(getInternalHeavyValue());
|
||||
assertSame(getHeavy(), getInternalHeavyValue());
|
||||
assertTimeout(ofMillis(3000), () -> {
|
||||
assertNull(getInternalHeavyValue());
|
||||
assertNotNull(getHeavy());
|
||||
assertNotNull(getInternalHeavyValue());
|
||||
assertSame(getHeavy(), getInternalHeavyValue());
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -22,7 +22,7 @@
|
||||
*/
|
||||
package com.iluwatar.lazy.loading;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
/**
|
||||
*
|
||||
|
Reference in New Issue
Block a user