Bug 5947: refactored common-api tests
authorPeter Nosal <peter.nosal@pantheon.tech>
Mon, 25 Jul 2016 12:50:16 +0000 (14:50 +0200)
committerAnil Belur <abelur@linuxfoundation.org>
Wed, 19 Jun 2024 00:41:20 +0000 (10:41 +1000)
Change-Id: I3b138c524094fcd6c63c46493c8af42c5d0c0d5a
Signed-off-by: Peter Nosal <peter.nosal@pantheon.tech>
binding/mdsal-binding-dom-codec/pom.xml
binding/mdsal-binding-dom-codec/src/test/java/org/opendaylight/yangtools/binding/data/codec/impl/NonCachingCodecTest.java [new file with mode: 0644]

index 46855b377041d63235475b68631079d0cf96adfa..42d92accf307b2464849981064d7cc8f2152e86a 100644 (file)
             <artifactId>junit</artifactId>
             <scope>test</scope>
         </dependency>
+        <dependency>
+            <groupId>org.opendaylight.yangtools</groupId>
+            <artifactId>mockito-configuration</artifactId>
+            <scope>test</scope>
+        </dependency>
     </dependencies>
 
     <build>
diff --git a/binding/mdsal-binding-dom-codec/src/test/java/org/opendaylight/yangtools/binding/data/codec/impl/NonCachingCodecTest.java b/binding/mdsal-binding-dom-codec/src/test/java/org/opendaylight/yangtools/binding/data/codec/impl/NonCachingCodecTest.java
new file mode 100644 (file)
index 0000000..b5672fd
--- /dev/null
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2016 Cisco Systems, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.yangtools.binding.data.codec.impl;
+
+import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.verify;
+
+import org.junit.Test;
+import org.opendaylight.mdsal.binding.dom.codec.api.BindingNormalizedNodeCodec;
+
+public class NonCachingCodecTest {
+
+    @Test
+    public void basicTest() throws Exception {
+        final BindingNormalizedNodeCodec codec = mock(BindingNormalizedNodeCodec.class);
+        doReturn(null).when(codec).serialize(null);
+        doReturn(null).when(codec).deserialize(null);
+        final NonCachingCodec nonCachingCodec = new NonCachingCodec<>(codec);
+        nonCachingCodec.serialize(null);
+        verify(codec).serialize(null);
+        nonCachingCodec.deserialize(null);
+        verify(codec).deserialize(null);
+    }
+}
\ No newline at end of file