Remove useless warning about rounding
[netconf.git] / protocol / netconf-api / src / test / java / org / opendaylight / netconf / api / messages / NetconfMessageTest.java
index 86bc60010d5150ed1bf7513f9fbcba692ef8c2ea..435404a341a8c1f5eba889d7bcaf0d904f2652a2 100644 (file)
@@ -49,6 +49,20 @@ class NetconfMessageTest {
             """, msg.toString());
     }
 
+    @Test
+    void testOfNotificationNanos() throws Exception {
+        final var eventTime = Instant.ofEpochSecond(42, 123456789);
+        final var expected = NotificationMessage.ofNotificationContent(getTestElement(), eventTime);
+        final var msg = assertInstanceOf(NotificationMessage.class, NetconfMessage.of(expected.getDocument()));
+        assertEquals("""
+            <notification xmlns="urn:ietf:params:xml:ns:netconf:notification:1.0">
+                <test-root/>
+                <eventTime>1970-01-01T00:00:42.123456789Z</eventTime>
+            </notification>
+            """, msg.toString());
+        assertEquals(eventTime, msg.getEventTime());
+    }
+
     @Test
     void testOfRpc() throws Exception {
         final var expected = RpcMessage.ofOperation(MESSAGE_ID, getTestElement());