Convert util class convention tests to @Nested test
This commit is contained in:
parent
0b14928ee4
commit
89f3d989e0
|
@ -23,8 +23,6 @@ import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
import java.lang.reflect.Constructor;
|
import java.lang.reflect.Constructor;
|
||||||
import java.lang.reflect.Modifier;
|
import java.lang.reflect.Modifier;
|
||||||
import java.util.AbstractList;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -37,23 +35,12 @@ import static org.junit.jupiter.api.Assertions.assertNotNull;
|
||||||
import static org.junit.jupiter.api.Assertions.assertSame;
|
import static org.junit.jupiter.api.Assertions.assertSame;
|
||||||
import static org.junit.jupiter.api.Assertions.assertThrows;
|
import static org.junit.jupiter.api.Assertions.assertThrows;
|
||||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||||
import static org.junit.jupiter.api.Assertions.fail;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Unit tests {@link org.apache.commons.lang3.Validate}.
|
* Unit tests {@link org.apache.commons.lang3.Validate}.
|
||||||
*/
|
*/
|
||||||
class ValidateTest {
|
class ValidateTest {
|
||||||
|
|
||||||
@Test
|
|
||||||
void testConstructor() {
|
|
||||||
assertNotNull(new Validate());
|
|
||||||
final Constructor<?>[] cons = Validate.class.getDeclaredConstructors();
|
|
||||||
assertEquals(1, cons.length);
|
|
||||||
assertTrue(Modifier.isPublic(cons[0].getModifiers()));
|
|
||||||
assertTrue(Modifier.isPublic(Validate.class.getModifiers()));
|
|
||||||
assertFalse(Modifier.isFinal(Validate.class.getModifiers()));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Nested
|
@Nested
|
||||||
class IsTrue {
|
class IsTrue {
|
||||||
|
|
||||||
|
@ -1882,4 +1869,29 @@ class ValidateTest {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Nested
|
||||||
|
class UtilClassConventions {
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void instancesCanBeConstrcuted() {
|
||||||
|
assertNotNull(new Validate());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void hasOnlyOnePublicConstructor() {
|
||||||
|
final Constructor<?>[] cons = Validate.class.getDeclaredConstructors();
|
||||||
|
assertEquals(1, cons.length);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void isPublicClass() {
|
||||||
|
assertTrue(Modifier.isPublic(Validate.class.getModifiers()));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void isNonFinalClass() {
|
||||||
|
assertFalse(Modifier.isFinal(Validate.class.getModifiers()));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue