forked from open-telemetry/opentelemetry-java
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathOtelImplJavadocTest.java
More file actions
75 lines (69 loc) · 2.74 KB
/
Copy pathOtelImplJavadocTest.java
File metadata and controls
75 lines (69 loc) · 2.74 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
/*
* Copyright The OpenTelemetry Authors
* SPDX-License-Identifier: Apache-2.0
*/
package io.opentelemetry.gradle.customchecks;
import com.google.errorprone.CompilationTestHelper;
import org.junit.jupiter.api.Test;
class OtelImplJavadocTest {
@Test
void positiveCases() {
CompilationTestHelper.newInstance(OtelImplJavadoc.class, OtelImplJavadocTest.class)
.addSourceLines(
"impl/ImplJavadocPositiveCases.java",
"/*",
" * Copyright The OpenTelemetry Authors",
" * SPDX-License-Identifier: Apache-2.0",
" */",
"package io.opentelemetry.gradle.customchecks.impl;",
"// BUG: Diagnostic contains: missing the required javadoc disclaimer",
"public class ImplJavadocPositiveCases {",
" // BUG: Diagnostic contains: missing the required javadoc disclaimer",
" public static class One {}",
" /** Doesn't have the disclaimer. */",
" // BUG: Diagnostic contains: missing the required javadoc disclaimer",
" public static class Two {}",
"}")
.doTest();
}
@Test
void negativeCases() {
CompilationTestHelper.newInstance(OtelImplJavadoc.class, OtelImplJavadocTest.class)
.addSourceLines(
"impl/ImplJavadocNegativeCases.java",
"/*",
" * Copyright The OpenTelemetry Authors",
" * SPDX-License-Identifier: Apache-2.0",
" */",
"package io.opentelemetry.gradle.customchecks.impl;",
"/**",
" * This class is not intended for use by application developers. Its API is stable and",
" * will not be changed or removed in a backwards-incompatible manner.",
" */",
"public class ImplJavadocNegativeCases {",
" /**",
" * This class is not intended for use by application developers. Its API is stable",
" * and will not be changed or removed in a backwards-incompatible manner.",
" */",
" public static class One {}",
" // Non-public class without disclaimer is fine.",
" static class Two {}",
"}")
.doTest();
}
@Test
void nonImplPackageIgnored() {
CompilationTestHelper.newInstance(OtelImplJavadoc.class, OtelImplJavadocTest.class)
.addSourceLines(
"other/NonImplPackageCases.java",
"/*",
" * Copyright The OpenTelemetry Authors",
" * SPDX-License-Identifier: Apache-2.0",
" */",
"package io.opentelemetry.gradle.customchecks.other;",
"public class NonImplPackageCases {",
" public static class One {}",
"}")
.doTest();
}
}