@@ -111,6 +111,30 @@ void cleanUp() {
111
111
repository .deleteBy ();
112
112
}
113
113
114
+ @ ParameterizedTest (name = "should find rooms by type {0}" )
115
+ @ EnumSource (RoomType .class )
116
+ void shouldFindRoomByType (RoomType type ) {
117
+ List <Room > rooms = this .repository .findByType (type );
118
+ SoftAssertions .assertSoftly (softly -> softly .assertThat (rooms ).allMatch (room -> room .getType ().equals (type )));
119
+ }
120
+
121
+ @ ParameterizedTest
122
+ @ MethodSource ("room" )
123
+ void shouldSaveRoom (Room room ) {
124
+ Room updateRoom = this .repository .newRoom (room );
125
+
126
+ SoftAssertions .assertSoftly (softly -> {
127
+ softly .assertThat (updateRoom ).isNotNull ();
128
+ softly .assertThat (updateRoom .getId ()).isNotNull ();
129
+ softly .assertThat (updateRoom .getRoomNumber ()).isEqualTo (room .getRoomNumber ());
130
+ softly .assertThat (updateRoom .getType ()).isEqualTo (room .getType ());
131
+ softly .assertThat (updateRoom .getStatus ()).isEqualTo (room .getStatus ());
132
+ softly .assertThat (updateRoom .getCleanStatus ()).isEqualTo (room .getCleanStatus ());
133
+ softly .assertThat (updateRoom .isSmokingAllowed ()).isEqualTo (room .isSmokingAllowed ());
134
+ });
135
+ }
136
+
137
+
114
138
@ Test
115
139
void shouldFindRoomReadyToGuest () {
116
140
List <Room > rooms = this .repository .findAvailableStandardRooms ();
@@ -152,29 +176,6 @@ void shouldFindRoomsNeedingCleaning() {
152
176
});
153
177
}
154
178
155
- @ ParameterizedTest (name = "should find rooms by type {0}" )
156
- @ EnumSource (RoomType .class )
157
- void shouldFindRoomByType (RoomType type ) {
158
- List <Room > rooms = this .repository .findByType (type );
159
- SoftAssertions .assertSoftly (softly -> softly .assertThat (rooms ).allMatch (room -> room .getType ().equals (type )));
160
- }
161
-
162
- @ ParameterizedTest
163
- @ MethodSource ("room" )
164
- void shouldSaveRoom (Room room ) {
165
- Room updateRoom = this .repository .newRoom (room );
166
-
167
- SoftAssertions .assertSoftly (softly -> {
168
- softly .assertThat (updateRoom ).isNotNull ();
169
- softly .assertThat (updateRoom .getId ()).isNotNull ();
170
- softly .assertThat (updateRoom .getRoomNumber ()).isEqualTo (room .getRoomNumber ());
171
- softly .assertThat (updateRoom .getType ()).isEqualTo (room .getType ());
172
- softly .assertThat (updateRoom .getStatus ()).isEqualTo (room .getStatus ());
173
- softly .assertThat (updateRoom .getCleanStatus ()).isEqualTo (room .getCleanStatus ());
174
- softly .assertThat (updateRoom .isSmokingAllowed ()).isEqualTo (room .isSmokingAllowed ());
175
- });
176
- }
177
-
178
179
static Stream <Arguments > room () {
179
180
Room room = new RoomBuilder ()
180
181
.roomNumber (101 )
0 commit comments