We can use assertThrows() instead.
Change-Id: I8d752851d11496c74388f625067e41582447a8c5
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
import static org.junit.Assert.assertNotEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
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 static org.junit.Assert.assertTrue;
import static org.mockito.Mockito.mock;
import java.io.Serializable;
import java.util.Optional;
import java.util.Set;
import java.io.Serializable;
import java.util.Optional;
import java.util.Set;
-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;
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"));
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>
/*
* Tests methods:
* <ul>
*/
@Test
public void testPackageNameForGeneratedTypeNullBasePackageName() {
*/
@Test
public void testPackageNameForGeneratedTypeNullBasePackageName() {
- expectedEx.expect(NullPointerException.class);
- BindingGeneratorUtil.packageNameForGeneratedType(null, null);
+ assertThrows(NullPointerException.class, () -> BindingGeneratorUtil.packageNameForGeneratedType(null, null));
*/
@Test
public void testPackageNameForGeneratedTypeNullSchemaPath() {
*/
@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 static org.junit.Assert.assertNotEquals;
import static org.junit.Assert.assertTrue;
-import org.junit.rules.ExpectedException;
import org.opendaylight.mdsal.binding.model.api.JavaTypeName;
public class TypeNameTest {
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");
@Test
public void testHashCode() {
JavaTypeName baseType1 = JavaTypeName.create("org.opendaylight.yangtools.test", "Test");