blob: fbf9bd1dc2321abfd5389cda9a98dc43754e6dd0 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
// Copyright Verizon Media. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.container.logging;
import org.junit.Assert;
import org.junit.Test;
import java.io.IOException;
import java.time.Instant;
import java.util.UUID;
/**
* @author mortent
*/
public class ConnectionLogEntryTest {
@Test
public void test_serialization () throws IOException {
var id = UUID.randomUUID();
var instant = Instant.parse("2021-01-13T12:12:12Z");
ConnectionLogEntry entry = ConnectionLogEntry.builder(id, instant)
.withPeerPort(1234)
.build();
String expected = "{" +
"\"id\":\""+id.toString()+"\"," +
"\"timestamp\":\"2021-01-13T12:12:12Z\"," +
"\"peerPort\":1234" +
"}";
Assert.assertEquals(expected, entry.toJson());
}
}
|