@@ -64,10 +64,10 @@ public void restartOffset() {
64
64
65
65
66
66
public PaginatedSequence <User > shouldGetUsers () throws InterruptedException , ExecutionException , TimeoutException {
67
- return Await .result (UserRepository .getUsers ( 0 , 10 ));
67
+ return Await .result (UserRepository .getUsers (0 , 10 ));
68
68
}
69
69
70
- @ Test
70
+ @ Test
71
71
public void shouldCreateUser () throws InterruptedException , ExecutionException , TimeoutException {
72
72
feed (new PUserEvent .PUserCreated (userCreated ));
73
73
PaginatedSequence <User > users = shouldGetUsers ();
@@ -80,28 +80,23 @@ public void shouldCreateUser() throws InterruptedException, ExecutionException,
80
80
@ Test
81
81
public void shouldPaginateUserRetrieval () throws InterruptedException , ExecutionException , TimeoutException {
82
82
for (int i = 0 ; i < 25 ; i ++) {
83
- feed (new PUserEvent .PUserCreated (buildFixture (userId )));
83
+ feed (new PUserEvent .PUserCreated (buildFixture (UUID . randomUUID (), i )));
84
84
}
85
85
86
-
87
- PaginatedSequence <User > createdUsers = Await .result (UserRepository .getUsers ( 1 , 10 ));
88
- assertEquals (25 , createdUsers .getCount ());
89
- assertEquals (10 , createdUsers .getItems ().size ());
90
- // default ordering is time DESC so page 2 of size 10 over a set of 25 returns item ids 5-14. On that seq, the fifth item is id=10
91
- assertEquals ("user10" , createdUsers .getItems ().get (4 ).getName ());
86
+ PaginatedSequence <User > createdUsers = Await .result (UserRepository .getUsers (1 , 10 ));
87
+ assertEquals (10 , createdUsers .getCount ());
92
88
93
89
}
94
90
95
- private PUser buildFixture (UUID id ) {
96
- return new PUser (id ,name , email ,password );
91
+ private PUser buildFixture (UUID id , int i ) {
92
+ return new PUser (id , name + i , i + email , password );
97
93
}
98
94
99
95
private void feed (PUserEvent userEvent ) throws InterruptedException , ExecutionException , TimeoutException {
100
96
Await .result (testDriver .feed (userEvent , Offset .sequence (offset .getAndIncrement ())));
101
97
}
102
98
103
-
104
99
105
- }
100
+ }
106
101
107
102
0 commit comments