-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathExampleTest.java
More file actions
33 lines (25 loc) · 793 Bytes
/
Copy pathExampleTest.java
File metadata and controls
33 lines (25 loc) · 793 Bytes
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
33
package org;
import org.junit.jupiter.api.Test;
import org.slf4j.LoggerFactory;
import java.util.Optional;
import static org.assertj.core.api.Assertions.assertThat;
public class ExampleTest {
@Test
void example() {
assertThat(Optional.empty()).isEmpty();
}
@Test
void loggingJsonStrings() {
var logger = LoggerFactory.getLogger("Hello Logger");
logger.info("\"Hello\"");
}
@Test
void loggingDto() {
record NestedDto(String chicken) {}
record LoggingDto(String key, String property, NestedDto nested) {
}
var logger = LoggerFactory.getLogger("Hello Logger");
var dto = new LoggingDto("one", "two", new NestedDto("egg"));
logger.atInfo().addKeyValue("user_info", dto).log();
}
}