*/
package org.opendaylight.yangtools.yang.common;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import com.google.common.collect.ImmutableBiMap;
import java.io.ByteArrayInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.util.Optional;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class BiMapYangNamespaceContextTest {
private static final QNameModule FOO = QNameModule.create(XMLNamespace.of("foo"));
*/
package org.opendaylight.yangtools.yang.common;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertThrows;
-import static org.junit.Assert.assertTrue;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import java.math.BigDecimal;
import java.math.RoundingMode;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class Decimal64Test {
@Test
*/
package org.opendaylight.yangtools.yang.common;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertSame;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertSame;
import org.eclipse.jdt.annotation.NonNullByDefault;
import org.eclipse.jdt.annotation.Nullable;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import org.opendaylight.yangtools.concepts.Either;
@NonNullByDefault
*/
package org.opendaylight.yangtools.yang.common;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertSame;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertSame;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class EmptyTest {
*/
package org.opendaylight.yangtools.yang.common;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class ErrorTagTest {
@Test
import static org.hamcrest.CoreMatchers.containsString;
import static org.hamcrest.MatcherAssert.assertThat;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class OperationFailedExceptionTest {
@Test
*/
package org.opendaylight.yangtools.yang.common;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertThrows;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import java.net.URISyntaxException;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class QNameTest {
private static final String NAMESPACE = "urn:foo";
*/
package org.opendaylight.yangtools.yang.common;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertThrows;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.ObjectOutputStream;
import java.time.format.DateTimeParseException;
import java.util.Optional;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class RevisionTest {
@Test
*/
package org.opendaylight.yangtools.yang.common;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.greaterThanOrEqualTo;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.util.List;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
/**
* Unit tests for RpcResultBuilder.
public void testSuccess() {
RpcResult<String> result = RpcResultBuilder.<String>success().withResult("foo").build();
verifyRpcResult(result, true, "foo");
- assertNotNull("getErrors returned null", result.getErrors());
- assertEquals("getErrors size", 0, result.getErrors().size());
+ assertEquals(List.of(), result.getErrors());
result = RpcResultBuilder.success("bar").build();
verifyRpcResult(result, true, "bar");
"my-info", cause);
verifyRpcError(result, 3, ErrorSeverity.ERROR, ErrorType.TRANSPORT, ErrorTag.OPERATION_FAILED,
"error message 4", null, null, cause2);
- assertEquals("getErrors size", 4, result.getErrors().size());
+ assertEquals(4, result.getErrors().size());
}
@Test
null, null);
verifyRpcError(result, 1, ErrorSeverity.WARNING, ErrorType.RPC, ErrorTag.IN_USE, "message 2", "my-app-tag",
"my-info", cause);
- assertEquals("getErrors size", 2, result.getErrors().size());
+ assertEquals(2, result.getErrors().size());
}
@Test
final String expInfo, final Throwable expCause) {
List<RpcError> errors = result.getErrors();
- assertTrue("Expected error at index " + errorIndex + " not found", errorIndex < errors.size());
+ assertThat(errors.size(), greaterThanOrEqualTo(errorIndex));
+
RpcError error = errors.get(errorIndex);
- assertEquals("getSeverity", expSeverity, error.getSeverity());
- assertEquals("getErrorType", expErrorType, error.getErrorType());
- assertEquals("getTag", expTag, error.getTag());
- assertEquals("getMessage", expMessage, error.getMessage());
- assertEquals("getApplicationTag", expAppTag, error.getApplicationTag());
- assertEquals("getInfo", expInfo, error.getInfo());
- assertEquals("getCause", expCause, error.getCause());
+ assertEquals(expSeverity, error.getSeverity());
+ assertEquals(expErrorType, error.getErrorType());
+ assertEquals(expTag, error.getTag());
+ assertEquals(expMessage, error.getMessage());
+ assertEquals(expAppTag, error.getApplicationTag());
+ assertEquals(expInfo, error.getInfo());
+ assertEquals(expCause, error.getCause());
}
void verifyRpcResult(final RpcResult<?> result, final boolean expSuccess, final Object expValue) {
- assertEquals("isSuccessful", expSuccess, result.isSuccessful());
- assertEquals("getResult", expValue, result.getResult());
+ assertEquals(expSuccess, result.isSuccessful());
+ assertEquals(expValue, result.getResult());
}
}
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.greaterThan;
import static org.hamcrest.Matchers.lessThan;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertSame;
-import static org.junit.Assert.assertThrows;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class Uint16Test {
@Test
*/
package org.opendaylight.yangtools.yang.common;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertSame;
-import static org.junit.Assert.assertThrows;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertSame;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import com.google.common.primitives.UnsignedInteger;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class Uint32Test {
@Test
*/
package org.opendaylight.yangtools.yang.common;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertSame;
-import static org.junit.Assert.assertThrows;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertSame;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import com.google.common.primitives.UnsignedLong;
import java.io.ByteArrayInputStream;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.math.BigInteger;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class Uint64Test {
@Test
*/
package org.opendaylight.yangtools.yang.common;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertSame;
-import static org.junit.Assert.assertThrows;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertSame;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class Uint8Test {
@Test
*/
package org.opendaylight.yangtools.yang.common;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class YangConstantsTest {
@Test
*/
package org.opendaylight.yangtools.yang.common;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertThrows;
import java.util.AbstractMap.SimpleImmutableEntry;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class YangNamesTest {
@Test
*/
package org.opendaylight.yangtools.yang.common;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertThrows;
import java.util.Optional;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class YangVersionTest {
@Test