1212
1313public class HotelRoomSteps {
1414
15- @ Inject
16- private RoomService service ;
17-
1815 @ Inject
1916 private RoomRepository repository ;
2017
@@ -25,7 +22,6 @@ public void cleanDatabase() {
2522
2623 @ Given ("the hotel management system is operational" )
2724 public void the_hotel_management_system_is_operational () {
28- Assertions .assertThat (service ).as ("RoomService should be initialized" ).isNotNull ();
2925 Assertions .assertThat (repository ).as ("RoomRepository should be initialized" ).isNotNull ();
3026 }
3127
@@ -37,7 +33,7 @@ public void i_register_a_room_with_number(Integer number) {
3733 .status (RoomStatus .AVAILABLE )
3834 .cleanStatus (CleanStatus .CLEAN )
3935 .build ();
40- service .save (room );
36+ repository .save (room );
4137 }
4238
4339 @ Then ("the room with number {int} should appear in the room list" )
@@ -50,7 +46,7 @@ public void the_room_with_number_should_appear_in_the_room_list(Integer number)
5046
5147 @ When ("I register the following rooms:" )
5248 public void i_register_the_following_rooms (List <Room > rooms ) {
53- rooms .forEach (service ::save );
49+ rooms .forEach (repository ::save );
5450 }
5551
5652 @ Then ("there should be {int} rooms available in the system" )
@@ -68,7 +64,7 @@ public void a_room_with_number_is_registered_as(Integer number, String statusNam
6864 .status (status )
6965 .cleanStatus (CleanStatus .CLEAN )
7066 .build ();
71- service .save (room );
67+ repository .save (room );
7268 }
7369
7470 @ When ("I mark the room {int} as {word}" )
@@ -86,7 +82,7 @@ public void i_mark_the_room_as(Integer number, String newStatusName) {
8682 Room updatedRoom = roomOpt .orElseThrow ();
8783 updatedRoom .update (newStatus );
8884
89- service .save (updatedRoom );
85+ repository .save (updatedRoom );
9086 }
9187
9288 @ Then ("the room {int} should be marked as {word}" )
0 commit comments