5
5
import ch .prevo .open .hub .nodes .NodeConfiguration ;
6
6
import ch .prevo .open .hub .nodes .NodeRegistry ;
7
7
import ch .prevo .open .hub .nodes .NodeService ;
8
-
9
8
import org .junit .Before ;
10
9
import org .junit .ClassRule ;
11
10
import org .junit .Test ;
23
22
import java .util .List ;
24
23
25
24
import static java .util .Arrays .asList ;
26
- import static java .util .Collections .singletonList ;
27
25
import static org .assertj .core .api .Java6Assertions .assertThat ;
28
26
import static org .mockito .Mockito .verify ;
29
27
import static org .mockito .Mockito .when ;
@@ -54,10 +52,10 @@ public class HubIntegrationTest {
54
52
public void setup () {
55
53
56
54
NodeConfiguration nodeBaloise = new NodeConfiguration (getBaseUrlForNode ("node_baloise" ),
57
- singletonList ( "CHE-109.740.084-Baloise-Sammelstiftung" ) );
55
+ "CHE-109.740.084-Baloise-Sammelstiftung" , "CHE-109.740.084-Baloise-Sammelstiftung 2" );
58
56
59
57
NodeConfiguration nodeHelvetia = new NodeConfiguration (getBaseUrlForNode ("node_helvetia" ),
60
- singletonList ( "CHE-109.537.488-Helvetia-Prisma-Sammelstiftung" ) );
58
+ "CHE-109.537.488-Helvetia-Prisma-Sammelstiftung" , "CHE-109.537.488-Helvetia-Prisma-Sammelstiftung 2" );
61
59
62
60
when (nodeRegistry .getCurrentNodes ()).thenReturn (asList (nodeBaloise , nodeHelvetia ));
63
61
}
@@ -71,19 +69,38 @@ private String getBaseUrlForNode(String nodeName) {
71
69
@ Test
72
70
public void testMatchingService () {
73
71
//given
74
- Match expectedMatchFromHelvetiaToBaloise = new Match ("756.1234.5678.97" ,
72
+ Match expectedMatchFromHelvetia1ToBaloise1 = new Match ("756.1234.5678.97" ,
73
+ "CHE-109.537.488-Helvetia-Prisma-Sammelstiftung" ,
74
+ "CHE-109.740.084-Baloise-Sammelstiftung" , LocalDate .of (2018 , 7 , 1 ), LocalDate .of (2018 , 6 , 30 ));
75
+ Match expectedMatchFromHelvetia1ToBaloise2 = new Match ("756.3324.5678.58" ,
75
76
"CHE-109.537.488-Helvetia-Prisma-Sammelstiftung" ,
77
+ "CHE-109.740.084-Baloise-Sammelstiftung 2" , LocalDate .of (2018 , 7 , 1 ), LocalDate .of (2018 , 6 , 30 ));
78
+ Match expectedMatchFromHelvetia2ToBaloise1 = new Match ("756.5678.1234.17" ,
79
+ "CHE-109.537.488-Helvetia-Prisma-Sammelstiftung 2" ,
76
80
"CHE-109.740.084-Baloise-Sammelstiftung" , LocalDate .of (2018 , 7 , 1 ), LocalDate .of (2018 , 6 , 30 ));
77
- Match expectedMatchFromBaloiseToHelvetia = new Match ("756.1335.5778.23" ,
81
+ Match expectedMatchFromBaloise1ToHelvetia1 = new Match ("756.1335.5778.23" ,
82
+ "CHE-109.740.084-Baloise-Sammelstiftung" ,
83
+ "CHE-109.537.488-Helvetia-Prisma-Sammelstiftung" , LocalDate .of (2018 , 7 , 1 ), LocalDate .of (2018 , 6 , 30 ));
84
+ Match expectedMatchFromBaloise1ToHelvetia2 = new Match ("756.9534.5271.94" ,
78
85
"CHE-109.740.084-Baloise-Sammelstiftung" ,
86
+ "CHE-109.537.488-Helvetia-Prisma-Sammelstiftung 2" , LocalDate .of (2018 , 7 , 1 ), LocalDate .of (2018 , 6 , 30 ));
87
+ Match expectedMatchFromBaloise2ToHelvetia1 = new Match ("756.9874.5778.58" ,
88
+ "CHE-109.740.084-Baloise-Sammelstiftung 2" ,
79
89
"CHE-109.537.488-Helvetia-Prisma-Sammelstiftung" , LocalDate .of (2018 , 7 , 1 ), LocalDate .of (2018 , 6 , 30 ));
80
90
81
91
// when
82
92
List <Match > matches = hubService .matchAndNotify ();
83
93
84
94
// then
85
- assertThat (matches ).hasSize (2 )
86
- .containsExactlyInAnyOrder (expectedMatchFromHelvetiaToBaloise , expectedMatchFromBaloiseToHelvetia );
95
+ assertThat (matches )
96
+ .containsExactlyInAnyOrder (
97
+ expectedMatchFromHelvetia1ToBaloise1 ,
98
+ expectedMatchFromHelvetia1ToBaloise2 ,
99
+ expectedMatchFromHelvetia2ToBaloise1 ,
100
+ expectedMatchFromBaloise1ToHelvetia1 ,
101
+ expectedMatchFromBaloise1ToHelvetia2 ,
102
+ expectedMatchFromBaloise2ToHelvetia1
103
+ );
87
104
verify (nodeService ).notifyMatches (matches );
88
105
}
89
106
}
0 commit comments