Skip to content

Commit 4188a6d

Browse files
committed
add ProductTs test
1 parent e75fb25 commit 4188a6d

File tree

1 file changed

+60
-0
lines changed

1 file changed

+60
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
package datadog.trace.api
2+
3+
import datadog.trace.test.util.DDSpecification
4+
5+
class ProductTsTest extends DDSpecification {
6+
7+
void 'test updateProduct'(){
8+
when:
9+
final result = ProductTs.updateProduct(init, newProduct)
10+
11+
then:
12+
result == expected
13+
14+
where:
15+
init | newProduct | expected
16+
0 | ProductTs.ASM | ProductTs.ASM
17+
ProductTs.ASM | ProductTs.DSM | 6
18+
}
19+
20+
void 'test isProductMarked'(){
21+
when:
22+
final result = ProductTs.isProductMarked(value, product)
23+
24+
then:
25+
result == expected
26+
27+
where:
28+
value | product | expected
29+
ProductTs.ASM | ProductTs.ASM | true
30+
ProductTs.DSM | ProductTs.ASM | false
31+
}
32+
33+
void 'test getBitfieldHex'(){
34+
when:
35+
final result = ProductTs.getBitfieldHex(value)
36+
37+
then:
38+
result == expected
39+
40+
where:
41+
value | expected
42+
0 | "00"
43+
ProductTs.ASM | "02"
44+
}
45+
46+
void 'test parseBitfieldHex'(){
47+
when:
48+
final result = ProductTs.parseBitfieldHex(hex)
49+
50+
then:
51+
result == expected
52+
53+
where:
54+
hex | expected
55+
"00" | 0
56+
null | 0
57+
"" | 0
58+
"02" | ProductTs.ASM
59+
}
60+
}

0 commit comments

Comments
 (0)