mirror of
https://github.com/tiennm99/java-design-patterns.git
synced 2026-05-14 16:58:47 +00:00
Migrate to JUnit5
This commit is contained in:
@@ -22,10 +22,11 @@
|
||||
*/
|
||||
package com.iluwatar.featuretoggle.user;
|
||||
|
||||
import static junit.framework.TestCase.assertFalse;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.junit.Test;
|
||||
import static org.junit.jupiter.api.Assertions.assertFalse;
|
||||
import static org.junit.jupiter.api.Assertions.assertThrows;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
|
||||
/**
|
||||
* Test User Group specific feature
|
||||
@@ -46,17 +47,21 @@ public class UserGroupTest {
|
||||
assertTrue(UserGroup.isPaid(user));
|
||||
}
|
||||
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
@Test
|
||||
public void testAddUserToPaidWhenOnFree() throws Exception {
|
||||
User user = new User("Paid User");
|
||||
UserGroup.addUserToFreeGroup(user);
|
||||
UserGroup.addUserToPaidGroup(user);
|
||||
assertThrows(IllegalArgumentException.class, () -> {
|
||||
UserGroup.addUserToPaidGroup(user);
|
||||
});
|
||||
}
|
||||
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
@Test
|
||||
public void testAddUserToFreeWhenOnPaid() throws Exception {
|
||||
User user = new User("Free User");
|
||||
UserGroup.addUserToPaidGroup(user);
|
||||
UserGroup.addUserToFreeGroup(user);
|
||||
assertThrows(IllegalArgumentException.class, () -> {
|
||||
UserGroup.addUserToFreeGroup(user);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user