forked from github/copilot-sdk-java
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTelemetryConfigTest.java
More file actions
77 lines (63 loc) · 2.49 KB
/
TelemetryConfigTest.java
File metadata and controls
77 lines (63 loc) · 2.49 KB
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
*--------------------------------------------------------------------------------------------*/
package com.github.copilot.sdk;
import static org.junit.jupiter.api.Assertions.*;
import org.junit.jupiter.api.Test;
import com.github.copilot.sdk.json.TelemetryConfig;
/**
* Unit tests for {@link TelemetryConfig} getters, setters, and fluent chaining.
*/
class TelemetryConfigTest {
@Test
void defaultValuesAreNull() {
var config = new TelemetryConfig();
assertNull(config.getOtlpEndpoint());
assertNull(config.getFilePath());
assertNull(config.getExporterType());
assertNull(config.getSourceName());
assertNull(config.getCaptureContent());
}
@Test
void otlpEndpointGetterSetter() {
var config = new TelemetryConfig();
config.setOtlpEndpoint("http://localhost:4318");
assertEquals("http://localhost:4318", config.getOtlpEndpoint());
}
@Test
void filePathGetterSetter() {
var config = new TelemetryConfig();
config.setFilePath("/tmp/telemetry.log");
assertEquals("/tmp/telemetry.log", config.getFilePath());
}
@Test
void exporterTypeGetterSetter() {
var config = new TelemetryConfig();
config.setExporterType("otlp-http");
assertEquals("otlp-http", config.getExporterType());
}
@Test
void sourceNameGetterSetter() {
var config = new TelemetryConfig();
config.setSourceName("my-app");
assertEquals("my-app", config.getSourceName());
}
@Test
void captureContentGetterSetter() {
var config = new TelemetryConfig();
config.setCaptureContent(true);
assertTrue(config.getCaptureContent());
config.setCaptureContent(false);
assertFalse(config.getCaptureContent());
}
@Test
void fluentChainingReturnsThis() {
var config = new TelemetryConfig().setOtlpEndpoint("http://localhost:4318").setFilePath("/tmp/spans.json")
.setExporterType("file").setSourceName("sdk-test").setCaptureContent(true);
assertEquals("http://localhost:4318", config.getOtlpEndpoint());
assertEquals("/tmp/spans.json", config.getFilePath());
assertEquals("file", config.getExporterType());
assertEquals("sdk-test", config.getSourceName());
assertTrue(config.getCaptureContent());
}
}