import static org.junit.Assert.assertNotEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertThrows;
import static org.junit.Assert.assertTrue;
import static org.mockito.Mockito.mock;
import java.io.Serializable;
import java.util.Optional;
import java.util.Set;
-import org.junit.Rule;
import org.junit.Test;
-import org.junit.rules.ExpectedException;
import org.opendaylight.mdsal.binding.model.api.AccessModifier;
import org.opendaylight.mdsal.binding.model.api.JavaTypeName;
import org.opendaylight.mdsal.binding.model.api.Restrictions;
public class BindingGeneratorUtilTest {
private static final SchemaPath ROOT_PATH = SchemaPath.create(true, QName.create("test", "root"));
- @Rule
- public ExpectedException expectedEx = ExpectedException.none();
-
/*
* Tests methods:
* <ul>
*/
@Test
public void testPackageNameForGeneratedTypeNullBasePackageName() {
- expectedEx.expect(NullPointerException.class);
- BindingGeneratorUtil.packageNameForGeneratedType(null, null);
+ assertThrows(NullPointerException.class, () -> BindingGeneratorUtil.packageNameForGeneratedType(null, null));
}
/*
*/
@Test
public void testPackageNameForGeneratedTypeNullSchemaPath() {
- expectedEx.expect(NullPointerException.class);
- BindingGeneratorUtil.packageNameForGeneratedType("test.package", null);
+ assertThrows(NullPointerException.class,
+ () -> BindingGeneratorUtil.packageNameForGeneratedType("test.package", null));
}
/*
import static org.junit.Assert.assertNotEquals;
import static org.junit.Assert.assertTrue;
-import org.junit.Rule;
import org.junit.Test;
-import org.junit.rules.ExpectedException;
import org.opendaylight.mdsal.binding.model.api.JavaTypeName;
public class TypeNameTest {
-
- @Rule
- public ExpectedException expException = ExpectedException.none();
-
@Test
public void testHashCode() {
JavaTypeName baseType1 = JavaTypeName.create("org.opendaylight.yangtools.test", "Test");