1
1
package org .soujava .demos .mongodb .document ;
2
2
3
3
import jakarta .inject .Inject ;
4
- import org .assertj .core .api .Assertions ;
5
4
import org .assertj .core .api .SoftAssertions ;
6
5
import org .eclipse .jnosql .databases .mongodb .mapping .MongoDBTemplate ;
7
6
import org .eclipse .jnosql .mapping .Database ;
19
18
20
19
@ EnableAutoWeld
21
20
@ AddPackages (value = {Database .class , EntityConverter .class , DocumentTemplate .class , MongoDBTemplate .class })
22
- @ AddPackages (App .class )
21
+ @ AddPackages (Room .class )
23
22
@ AddPackages (ManagerSupplier .class )
24
23
@ AddPackages (MongoDBTemplate .class )
25
24
@ AddPackages (Reflections .class )
@@ -32,7 +31,27 @@ class AppTest {
32
31
33
32
@ Test
34
33
void shouldTest () {
34
+ Room room = new RoomBuilder ()
35
+ .id ("room-1" )
36
+ .roomNumber (101 )
37
+ .type (RoomType .SUITE )
38
+ .status (RoomStatus .AVAILABLE )
39
+ .cleanStatus (CleanStatus .CLEAN )
40
+ .smokingAllowed (false )
41
+ .underMaintenance (false )
42
+ .build ();
35
43
44
+ Room insert = template .insert (room );
45
+ SoftAssertions .assertSoftly (softly -> {
46
+ softly .assertThat (room .getId ()).isEqualTo (insert .getId ());
47
+ softly .assertThat (room .getRoomNumber ()).isEqualTo (insert .getRoomNumber ());
48
+ softly .assertThat (room .getType ()).isEqualTo (insert .getType ());
49
+ softly .assertThat (room .getStatus ()).isEqualTo (insert .getStatus ());
50
+ softly .assertThat (room .getCleanStatus ()).isEqualTo (insert .getCleanStatus ());
51
+ softly .assertThat (room .isSmokingAllowed ()).isEqualTo (insert .isSmokingAllowed ());
52
+ softly .assertThat (room .isUnderMaintenance ()).isEqualTo (insert .isUnderMaintenance ());
53
+ softly .assertThat (insert .getId ()).isNotNull ();
54
+ });
36
55
}
37
56
38
57
}
0 commit comments