File tree Expand file tree Collapse file tree 2 files changed +11
-7
lines changed
main/java/com/example/datastore/filters
test/java/com/example/datastore/filters Expand file tree Collapse file tree 2 files changed +11
-7
lines changed Original file line number Diff line number Diff line change 2929import com .google .cloud .datastore .QueryResults ;
3030import com .google .cloud .datastore .StructuredQuery .CompositeFilter ;
3131import com .google .cloud .datastore .StructuredQuery .PropertyFilter ;
32+ import java .util .ArrayList ;
33+ import java .util .List ;
3234
3335public class MultiIneqFilter {
3436 public static void invoke () throws Exception {
@@ -51,9 +53,11 @@ public static void invoke() throws Exception {
5153 throw new Exception ("query yielded no results" );
5254 }
5355
56+ List <Entity > entities = new ArrayList <>();
5457 while (results .hasNext ()) {
55- Entity entity = results .next ();
56- System .out .printf ("Entity: %s%n" , entity );
58+ entities .add (results .next ());
5759 }
60+
61+ return entities ;
5862 }
5963}
Original file line number Diff line number Diff line change 3030import org .junit .Test ;
3131import org .junit .runner .RunWith ;
3232import org .junit .runners .JUnit4 ;
33-
33+ import java .util .ArrayList ;
34+ import java .util .List ;
3435
3536@ RunWith (JUnit4 .class )
3637@ SuppressWarnings ("checkstyle:abbreviationaswordinname" )
@@ -86,10 +87,9 @@ public void tearDown() {
8687
8788 @ Test
8889 public void testMultiIneqFilter () throws Exception {
89- // Act
90- MultiIneqFilter .invoke ();
90+ List <Entity > results = MultiIneqFilter .invoke ();
9191
92- // Assert
93- systemsOutRule . assertContains ( "Entity" );
92+ assertEquals ( 3 , results . size ());
93+ assertEquals ( "Learn Cloud Datastore" , results . get ( 0 ). getString ( "description" ) );
9494 }
9595}
You can’t perform that action at this time.
0 commit comments