@@ -38,19 +38,40 @@ public void setUp() {
3838
3939 @ Test
4040 public void test_fetchGlobalField () throws Exception {
41- GlobalField globalField = stack .globalField ("specific_gf_uid" );
42- globalField .findAll (new GlobalFieldsResultCallback () {
41+ // GlobalField globalField = stack.globalField("specific_gf_uid").includeBranch();
42+ // globalField.fetch(new GlobalFieldsResultCallback() {
43+ // @Override
44+ // public void onCompletion(GlobalFieldsModel globalFieldsModel, Error error) {
45+ // if (error == null) {
46+ // JSONArray result = globalFieldsModel.getResultArray();
47+ // System.out.println("✅ Global Fields Response: " + result);
48+ //// Assertions.assertEquals("main", );
49+ // Log.d(TAG, "✅ Global Fields Response: " + result);
50+ // Assertions.assertNotNull(result);
51+ // } else {
52+ // System.out.println("❌ Error: " + error.getErrorMessage());
53+ // }
54+ // latch.countDown(); // Signal that response arrived
55+ // }
56+ // });
57+ CountDownLatch latch = new CountDownLatch (1 ); // <- define inside test
58+
59+ GlobalField globalField = stack .globalField ("specific_gf_uid" ).includeBranch ();
60+ globalField .fetch (new GlobalFieldsResultCallback () {
4361 @ Override
4462 public void onCompletion (GlobalFieldsModel globalFieldsModel , Error error ) {
4563 if (error == null ) {
4664 JSONArray result = globalFieldsModel .getResultArray ();
47- System .out .println ("✅ Global Fields Response: " + result );
65+ Log .d (TAG , "✅ Global Fields Response: " + result );
66+ Assertions .assertNotNull (result );
4867 } else {
49- System . out . println ( "❌ Error: " + error .getErrorMessage ());
68+ Log . e ( TAG , "❌ Error: " + error .getErrorMessage ());
5069 }
51- latch .countDown (); // Signal that response arrived
70+ latch .countDown ();
5271 }
5372 });
73+
74+ latch .await (10 , TimeUnit .SECONDS ); // Wait for callback
5475 }
5576
5677
0 commit comments