@@ -61,7 +61,7 @@ public void testCrossReferences() throws IOException {
6161 .as ("after create Things" ).get ()
6262 .satisfies (c -> {
6363 Assertions .assertThat (c .references ())
64- .as ("ownedBy" ).filteredOn (p -> p .name ().equals ("ownedBy" )).first ()
64+ .as ("ownedBy" ).filteredOn (p -> p .propertyName ().equals ("ownedBy" )).first ()
6565 .extracting (p -> p .dataTypes (), InstanceOfAssertFactories .LIST )
6666 .containsOnly (nsOwners );
6767 });
@@ -81,7 +81,7 @@ public void testCrossReferences() throws IOException {
8181 .as ("after add property" ).get ()
8282 .satisfies (c -> {
8383 Assertions .assertThat (c .references ())
84- .as ("soldIn" ).filteredOn (p -> p .name ().equals ("soldIn" )).first ()
84+ .as ("soldIn" ).filteredOn (p -> p .propertyName ().equals ("soldIn" )).first ()
8585 .extracting (p -> p .dataTypes (), InstanceOfAssertFactories .LIST )
8686 .containsOnly (nsOnlineStores , nsMarkets );
8787 });
@@ -117,33 +117,33 @@ public void testListDeleteAll() throws IOException {
117117
118118 @ Test
119119 public void testUpdateCollection () throws IOException {
120- try {
121- var nsBoxes = ns ("Boxes " );
122- var nsThings = ns ( "Things" );
123-
124- client . collections . create ( nsBoxes );
125-
126- client . collections . create ( nsThings ,
127- collection -> collection
128- . description ( "Things stored in boxes" )
129- . properties (
130- Property .text ( "name" ) ,
131- Property . integer ( "width" ))
132- . references (
133- Property . reference ( "storedIn" , nsBoxes )));
134-
135- var things = client .collections .use (nsThings );
136-
137- // Act
138- things .config .update (nsThings , collection -> collection
139- .description ("Things stored on shelves" ));
140-
141- // Assert
142- var thingsConfig = things . config . get ();
143- Assertions . assertThat ( thingsConfig ) .get ()
144- . returns ( "Things stored on shelves" , CollectionConfig :: description );
145- } catch ( Exception e ) {
146- e . printStackTrace ();
147- }
120+ var nsBoxes = ns ( "Boxes" );
121+ var nsThings = ns ("Things " );
122+
123+ client . collections . create ( nsBoxes );
124+
125+ client . collections . create ( nsThings ,
126+ collection -> collection
127+ . description ( "Things stored in boxes" )
128+ . properties (
129+ Property . text ( "name" ),
130+ Property .integer ( "width" ,
131+ w -> w . description ( "how wide this thing is" ) ))
132+ . invertedIndex ( index -> index . cleanupIntervalSeconds ( 10 ))
133+ . replication ( replicate -> replicate . asyncEnabled ( true )));
134+
135+ var things = client .collections .use (nsThings );
136+
137+ // Act
138+ things .config .update (nsThings , collection -> collection
139+ .description ("Things stored on shelves" )
140+ . propertyDescription ( "width" , "not height" ));
141+
142+ // Assert
143+ var updated = things . config .get ();
144+ Assertions . assertThat ( updated ). get ()
145+ . returns ( "Things stored on shelves" , CollectionConfig :: description )
146+ . extracting ( CollectionConfig :: properties , InstanceOfAssertFactories . list ( Property . class ))
147+ . extracting ( Property :: description ). contains ( "not height" );
148148 }
149149}
0 commit comments