6
6
7
7
import com .fasterxml .jackson .core .JsonProcessingException ;
8
8
import com .fasterxml .jackson .databind .ObjectMapper ;
9
- import java .util .Map ;
10
9
import org .apache .commons .math3 .random .RandomGenerator ;
11
10
import org .fairdatapipeline .distribution .Distribution .DistributionType ;
12
11
import org .fairdatapipeline .distribution .ImmutableDistribution ;
13
- import org .fairdatapipeline .estimate .ImmutableEstimate ;
14
12
import org .fairdatapipeline .mapper .DataPipelineMapper ;
15
- import org .fairdatapipeline .samples .ImmutableSamples ;
16
13
import org .junit .jupiter .api .*;
17
14
18
15
@ TestInstance (TestInstance .Lifecycle .PER_CLASS )
@@ -25,17 +22,9 @@ class ComponentsDeserializerTest {
25
22
+ " \" shape\" : 1,\n "
26
23
+ " \" type\" : \" distribution\" \n "
27
24
+ " },\n "
28
- + " \" example-estimate\" : {\n "
29
- + " \" type\" : \" point-estimate\" ,\n "
30
- + " \" value\" : 1.0\n "
31
- + " },\n "
32
- + " \" example-samples\" : {\n "
33
- + " \" samples\" : [\n "
34
- + " 1,\n "
35
- + " 2,\n "
36
- + " 3\n "
37
- + " ],\n "
38
- + " \" type\" : \" samples\" \n "
25
+ + " \" example-strings\" : {\n "
26
+ + " \" strings\" : [\" bram\" ,\" rosalie\" ],\n "
27
+ + " \" type\" : \" strings\" \n "
39
28
+ " }\n "
40
29
+ "}" ;
41
30
@@ -53,27 +42,28 @@ public void setUp() {
53
42
void deserialize () throws JsonProcessingException {
54
43
Components actualComponents = objectMapper .readValue (json , Components .class );
55
44
56
- var estimate = ImmutableEstimate .builder ().internalValue (1.0 ).rng (rng ).build ();
57
45
var distribution =
58
46
ImmutableDistribution .builder ()
59
47
.internalType (DistributionType .gamma )
60
48
.internalShape (1 )
61
49
.internalScale (2 )
62
50
.rng (rng )
63
51
.build ();
64
- var samples = ImmutableSamples .builder ().addSamples ( 1 , 2 , 3 ). rng ( rng ).build ();
65
- var expectedComponents =
52
+ var strings = ImmutableStringList .builder ().addStrings ( "bram" , "rosalie" ).build ();
53
+ Components components =
66
54
ImmutableComponents .builder ()
67
- .components (
68
- Map .of (
69
- "example-estimate" ,
70
- estimate ,
71
- "example-distribution" ,
72
- distribution ,
73
- "example-samples" ,
74
- samples ))
55
+ .putComponents ("example-distribution" , distribution )
56
+ .putComponents ("example-strings" , strings )
75
57
.build ();
58
+ /* var expectedComponents =
59
+ ImmutableComponents.builder()
60
+ .components(
61
+ Map.of(
62
+ "example-distribution",
63
+ distribution
64
+ ))
65
+ .build();*/
76
66
77
- assertThat (actualComponents ).isEqualTo (expectedComponents );
67
+ assertThat (actualComponents ).isEqualTo (components );
78
68
}
79
69
}
0 commit comments