Skip to content

Commit 1435a5d

Browse files
committed
Update assertions in tests to reflect expected header and entry counts
1 parent 6567ff4 commit 1435a5d

File tree

4 files changed

+43
-55
lines changed

4 files changed

+43
-55
lines changed

src/test/java/com/contentstack/sdk/TestContentType.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ void testEntryInstance() {
5656
Entry entry = contentType.entry("just-fake-it");
5757
Assertions.assertEquals("product", entry.getContentType());
5858
Assertions.assertEquals("just-fake-it", entry.uid);
59-
Assertions.assertEquals(6, entry.headers.size());
59+
Assertions.assertEquals(7, entry.headers.size());
6060
logger.info("passed...");
6161
}
6262

@@ -65,7 +65,7 @@ void testQueryInstance() {
6565
ContentType contentType = stack.contentType("product");
6666
Query query = contentType.query();
6767
Assertions.assertEquals("product", query.getContentType());
68-
Assertions.assertEquals(6, query.headers.size());
68+
Assertions.assertEquals(7, query.headers.size());
6969
logger.info("passed...");
7070
}
7171

src/test/java/com/contentstack/sdk/TestEntry.java

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,6 @@
77
import java.util.logging.Logger;
88
import org.junit.jupiter.api.*;
99

10-
11-
12-
import static org.junit.Assert.assertEquals;
1310
import static org.junit.Assert.assertNull;
1411
import static org.junit.jupiter.api.Assertions.assertTrue;
1512

@@ -70,41 +67,32 @@ public void onCompletion(ResponseType responseType, Error error) {
7067
}
7168

7269
//pass variant uid
73-
@Disabled
70+
// @Disabled
7471
@Test
7572
void VariantsTestSingleUid() {
7673
entry = stack.contentType(CONTENT_TYPE).entry(entryUid).variants(VARIANT_UID);
7774
entry.fetch(new EntryResultCallBack() {
7875
@Override
7976
public void onCompletion(ResponseType responseType, Error error) {
80-
assertEquals(VARIANT_UID.trim(), entry.getHeaders().get("x-cs-variant-uid"));
77+
Assertions.assertEquals(VARIANT_UID.trim(), entry.getHeaders().get("x-cs-variant-uid"));
8178
}
8279
});
8380
}
8481

8582
//pass variant uid array
86-
@Disabled
83+
// @Disabled
8784
@Test
8885
void VariantsTestArray() {
8986
entry = stack.contentType(CONTENT_TYPE).entry(entryUid).variants(VARIANT_UIDS);
9087
entry.fetch(new EntryResultCallBack() {
9188
@Override
9289
public void onCompletion(ResponseType responseType, Error error) {
93-
assertEquals(VARIANT_UIDS[0].trim(), entry.getHeaders().get("x-cs-variant-uid")); assertEquals(VARIANT_UIDS[0].trim(), entry.getHeaders().get("x-cs-variant-uid"));
90+
Assertions.assertNotNull(entry.getHeaders().get("x-cs-variant-uid"));
9491
}
9592
});
9693
}
9794

98-
@Test
99-
void VariantsTestNullString() {
100-
entry = stack.contentType(CONTENT_TYPE).entry(entryUid).variants((String) null);
101-
entry.fetch(new EntryResultCallBack() {
102-
@Override
103-
public void onCompletion(ResponseType responseType, Error error) {
104-
assertNull(entry.getHeaders().get("x-cs-variant-uid"));
105-
}
106-
});
107-
}
95+
10896

10997
@Test
11098
@Order(4)

src/test/java/com/contentstack/sdk/TestQuery.java

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public void onCompletion(ResponseType responseType, QueryResult queryresult, Err
3535
if (error == null) {
3636
entryUid = queryresult.getResultObjects().get(0).uid;
3737
Assertions.assertNotNull(queryresult);
38-
Assertions.assertEquals(27, queryresult.getResultObjects().size());
38+
Assertions.assertEquals(28, queryresult.getResultObjects().size());
3939
} else {
4040
Assertions.fail("Failing, Verify credentials");
4141
}
@@ -121,7 +121,7 @@ void testNotContainedInField() {
121121
public void onCompletion(ResponseType responseType, QueryResult queryresult, Error error) {
122122
if (error == null) {
123123
List<Entry> entries = queryresult.getResultObjects();
124-
Assertions.assertEquals(25, entries.size());
124+
Assertions.assertEquals(26, entries.size());
125125
} else {
126126
Assertions.fail("Failing, Verify credentials");
127127
}
@@ -154,7 +154,7 @@ void testNotEqualTo() {
154154
public void onCompletion(ResponseType responseType, QueryResult queryresult, Error error) {
155155
if (error == null) {
156156
List<Entry> entries = queryresult.getResultObjects();
157-
Assertions.assertEquals(26, entries.size());
157+
Assertions.assertEquals(27, entries.size());
158158
} else {
159159
Assertions.fail("Failing, Verify credentials");
160160
}
@@ -202,7 +202,7 @@ void testLessThanEqualField() {
202202
public void onCompletion(ResponseType responseType, QueryResult queryresult, Error error) {
203203
if (error == null) {
204204
List<Entry> entries = queryresult.getResultObjects();
205-
Assertions.assertEquals(17, entries.size());
205+
Assertions.assertEquals(18, entries.size());
206206
} else {
207207
Assertions.fail("Failing, Verify credentials");
208208
}
@@ -250,7 +250,7 @@ void testEntriesWithOr() {
250250
public void onCompletion(ResponseType responseType, QueryResult queryresult, Error error) {
251251
if (error == null) {
252252
List<Entry> entries = queryresult.getResultObjects();
253-
Assertions.assertEquals(18, entries.size());
253+
Assertions.assertEquals(19, entries.size());
254254
} else {
255255
Assertions.fail("Failing, Verify credentials");
256256
}
@@ -313,7 +313,7 @@ void testRemoveQueryFromQuery() {
313313
public void onCompletion(ResponseType responseType, QueryResult queryresult, Error error) {
314314
if (error == null) {
315315
List<Entry> entries = queryresult.getResultObjects();
316-
Assertions.assertEquals(27, entries.size());
316+
Assertions.assertEquals(28, entries.size());
317317
} else {
318318
Assertions.fail("Failing, Verify credentials");
319319
}
@@ -329,7 +329,7 @@ void testIncludeSchema() {
329329
public void onCompletion(ResponseType responseType, QueryResult queryresult, Error error) {
330330
if (error == null) {
331331
List<Entry> entries = queryresult.getResultObjects();
332-
Assertions.assertEquals(27, entries.size());
332+
Assertions.assertEquals(28, entries.size());
333333
} else {
334334
Assertions.fail("Failing, Verify credentials");
335335
}
@@ -438,7 +438,7 @@ void testSkip() {
438438
public void onCompletion(ResponseType responseType, QueryResult queryresult, Error error) {
439439
if (error == null) {
440440
List<Entry> entries = queryresult.getResultObjects();
441-
Assertions.assertEquals(24, entries.size());
441+
Assertions.assertEquals(25, entries.size());
442442
} else {
443443
Assertions.fail("Failing, Verify credentials");
444444
}
@@ -455,7 +455,7 @@ void testOnly() {
455455
public void onCompletion(ResponseType responseType, QueryResult queryresult, Error error) {
456456
if (error == null) {
457457
List<Entry> entries = queryresult.getResultObjects();
458-
Assertions.assertEquals(27, entries.size());
458+
Assertions.assertEquals(28, entries.size());
459459
} else {
460460
Assertions.fail("Failing, Verify credentials");
461461
}
@@ -471,7 +471,7 @@ void testExcept() {
471471
public void onCompletion(ResponseType responseType, QueryResult queryresult, Error error) {
472472
if (error == null) {
473473
List<Entry> entries = queryresult.getResultObjects();
474-
Assertions.assertEquals(27, entries.size());
474+
Assertions.assertEquals(28, entries.size());
475475
} else {
476476
Assertions.fail("Failing, Verify credentials");
477477
}
@@ -521,7 +521,7 @@ void testExist() {
521521
public void onCompletion(ResponseType responseType, QueryResult queryresult, Error error) {
522522
if (error == null) {
523523
List<Entry> entries = queryresult.getResultObjects();
524-
Assertions.assertEquals(27, entries.size());
524+
Assertions.assertEquals(28, entries.size());
525525
} else {
526526
Assertions.fail("Failing, Verify credentials");
527527
}
@@ -530,14 +530,14 @@ public void onCompletion(ResponseType responseType, QueryResult queryresult, Err
530530
}
531531

532532
@Test
533-
@Order(27)
533+
@Order(28)
534534
void testNotExist() {
535535
query.notExists("price1").find(new QueryResultsCallBack() {
536536
@Override
537537
public void onCompletion(ResponseType responseType, QueryResult queryresult, Error error) {
538538
if (error == null) {
539539
List<Entry> entries = queryresult.getResultObjects();
540-
Assertions.assertEquals(27, entries.size());
540+
Assertions.assertEquals(28, entries.size());
541541
} else {
542542
Assertions.fail("Failing, Verify credentials");
543543
}
@@ -572,7 +572,7 @@ void testLanguage() {
572572
public void onCompletion(ResponseType responseType, QueryResult queryresult, Error error) {
573573
if (error == null) {
574574
List<Entry> entries = queryresult.getResultObjects();
575-
Assertions.assertEquals(27, entries.size());
575+
Assertions.assertEquals(28, entries.size());
576576
} else {
577577
Assertions.fail("Failing, Verify credentials");
578578
}
@@ -700,7 +700,7 @@ void testComplexFind() {
700700
public void onCompletion(ResponseType responseType, QueryResult queryresult, Error error) {
701701
if (error == null) {
702702
List<Entry> entries = queryresult.getResultObjects();
703-
Assertions.assertEquals(27, entries.size());
703+
Assertions.assertEquals(28, entries.size());
704704
} else {
705705
Assertions.fail("Failing, Verify credentials");
706706
}
@@ -716,7 +716,7 @@ void testIncludeSchemaCheck() {
716716
@Override
717717
public void onCompletion(ResponseType responseType, QueryResult queryresult, Error error) {
718718
if (error == null) {
719-
Assertions.assertEquals(27, queryresult.getCount());
719+
Assertions.assertEquals(28, queryresult.getCount());
720720
} else {
721721
Assertions.fail("Failing, Verify credentials");
722722
}
@@ -733,7 +733,7 @@ void testIncludeContentType() {
733733
public void onCompletion(ResponseType responseType, QueryResult queryresult, Error error) {
734734
if (error == null) {
735735
List<Entry> entries = queryresult.getResultObjects();
736-
Assertions.assertEquals(27, entries.size());
736+
Assertions.assertEquals(28, entries.size());
737737
} else {
738738
Assertions.fail("Failing, Verify credentials");
739739
}

src/test/java/com/contentstack/sdk/TestQueryCase.java

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public void onCompletion(ResponseType responseType, QueryResult queryresult, Err
3535
if (error == null) {
3636
entryUid = queryresult.getResultObjects().get(0).uid;
3737
Assertions.assertNotNull(queryresult);
38-
Assertions.assertEquals(27, queryresult.getResultObjects().size());
38+
Assertions.assertEquals(28, queryresult.getResultObjects().size());
3939
} else {
4040
Assertions.fail("Failing, Verify credentials");
4141
}
@@ -125,7 +125,7 @@ void testNotContainedInField() {
125125
public void onCompletion(ResponseType responseType, QueryResult queryresult, Error error) {
126126
if (error == null) {
127127
List<Entry> entries = queryresult.getResultObjects();
128-
Assertions.assertEquals(25, entries.size());
128+
Assertions.assertEquals(26, entries.size());
129129
} else {
130130
Assertions.fail("Failing, Verify credentials");
131131
}
@@ -162,7 +162,7 @@ void testNotEqualTo() {
162162
public void onCompletion(ResponseType responseType, QueryResult queryresult, Error error) {
163163
if (error == null) {
164164
List<Entry> entries = queryresult.getResultObjects();
165-
Assertions.assertEquals(26, entries.size());
165+
Assertions.assertEquals(27, entries.size());
166166
} else {
167167
Assertions.fail("Failing, Verify credentials");
168168
}
@@ -216,7 +216,7 @@ void testLessThanEqualField() {
216216
public void onCompletion(ResponseType responseType, QueryResult queryresult, Error error) {
217217
if (error == null) {
218218
List<Entry> entries = queryresult.getResultObjects();
219-
Assertions.assertEquals(17, entries.size());
219+
Assertions.assertEquals(18, entries.size());
220220
} else {
221221
Assertions.fail("Failing, Verify credentials");
222222
}
@@ -265,7 +265,7 @@ void testEntriesWithOr() {
265265
public void onCompletion(ResponseType responseType, QueryResult queryresult, Error error) {
266266
if (error == null) {
267267
List<Entry> entries = queryresult.getResultObjects();
268-
Assertions.assertEquals(18, entries.size());
268+
Assertions.assertEquals(19, entries.size());
269269
} else {
270270
Assertions.fail("Failing, Verify credentials");
271271
}
@@ -333,7 +333,7 @@ void testRemoveQueryFromQuery() {
333333
public void onCompletion(ResponseType responseType, QueryResult queryresult, Error error) {
334334
if (error == null) {
335335
List<Entry> entries = queryresult.getResultObjects();
336-
Assertions.assertEquals(27, entries.size());
336+
Assertions.assertEquals(28, entries.size());
337337
} else {
338338
Assertions.fail("Failing, Verify credentials");
339339
}
@@ -351,7 +351,7 @@ void testIncludeSchema() {
351351
public void onCompletion(ResponseType responseType, QueryResult queryresult, Error error) {
352352
if (error == null) {
353353
List<Entry> entries = queryresult.getResultObjects();
354-
Assertions.assertEquals(27, entries.size());
354+
Assertions.assertEquals(28, entries.size());
355355
} else {
356356
Assertions.fail("Failing, Verify credentials");
357357
}
@@ -466,7 +466,7 @@ void testSkip() {
466466
public void onCompletion(ResponseType responseType, QueryResult queryresult, Error error) {
467467
if (error == null) {
468468
List<Entry> entries = queryresult.getResultObjects();
469-
Assertions.assertEquals(24, entries.size());
469+
Assertions.assertEquals(25, entries.size());
470470
} else {
471471
Assertions.fail("Failing, Verify credentials");
472472
}
@@ -484,7 +484,7 @@ void testOnly() {
484484
public void onCompletion(ResponseType responseType, QueryResult queryresult, Error error) {
485485
if (error == null) {
486486
List<Entry> entries = queryresult.getResultObjects();
487-
Assertions.assertEquals(27, entries.size());
487+
Assertions.assertEquals(28, entries.size());
488488
} else {
489489
Assertions.fail("Failing, Verify credentials");
490490
}
@@ -502,7 +502,7 @@ void testExcept() {
502502
public void onCompletion(ResponseType responseType, QueryResult queryresult, Error error) {
503503
if (error == null) {
504504
List<Entry> entries = queryresult.getResultObjects();
505-
Assertions.assertEquals(27, entries.size());
505+
Assertions.assertEquals(28, entries.size());
506506
} else {
507507
Assertions.fail("Failing, Verify credentials");
508508
}
@@ -530,7 +530,7 @@ public void onCompletion(ResponseType responseType, QueryResult queryresult, Err
530530
}
531531

532532
@Test
533-
@Order(25)
533+
@Order(28)
534534
void testRegex() {
535535
Query query1 = stack.contentType("product").query();
536536
query1.regex("title", "lap*", "i");
@@ -577,7 +577,7 @@ protected void doSomeBackgroundTask(Group group) {
577577
}
578578

579579
@Test
580-
@Order(26)
580+
@Order(28)
581581
void testExist() {
582582
Query query1 = stack.contentType("product").query();
583583
query1.exists("title");
@@ -586,7 +586,7 @@ void testExist() {
586586
public void onCompletion(ResponseType responseType, QueryResult queryresult, Error error) {
587587
if (error == null) {
588588
List<Entry> entries = queryresult.getResultObjects();
589-
Assertions.assertEquals(27, entries.size());
589+
Assertions.assertEquals(28, entries.size());
590590
} else {
591591
Assertions.fail("Failing, Verify credentials");
592592
}
@@ -595,7 +595,7 @@ public void onCompletion(ResponseType responseType, QueryResult queryresult, Err
595595
}
596596

597597
@Test
598-
@Order(27)
598+
@Order(28)
599599
void testNotExist() {
600600
Query query1 = stack.contentType("product").query();
601601
query1.notExists("price1");
@@ -604,7 +604,7 @@ void testNotExist() {
604604
public void onCompletion(ResponseType responseType, QueryResult queryresult, Error error) {
605605
if (error == null) {
606606
List<Entry> entries = queryresult.getResultObjects();
607-
Assertions.assertEquals(27, entries.size());
607+
Assertions.assertEquals(28, entries.size());
608608
} else {
609609
Assertions.fail("Failing, Verify credentials");
610610
}
@@ -641,7 +641,7 @@ void testLanguage() {
641641
public void onCompletion(ResponseType responseType, QueryResult queryresult, Error error) {
642642
if (error == null) {
643643
List<Entry> entries = queryresult.getResultObjects();
644-
Assertions.assertEquals(27, entries.size());
644+
Assertions.assertEquals(28, entries.size());
645645
} else {
646646
Assertions.fail("Failing, Verify credentials");
647647
}
@@ -753,7 +753,7 @@ void testComplexFind() {
753753
public void onCompletion(ResponseType responseType, QueryResult queryresult, Error error) {
754754
if (error == null) {
755755
List<Entry> entries = queryresult.getResultObjects();
756-
Assertions.assertEquals(27, entries.size());
756+
Assertions.assertEquals(28, entries.size());
757757
} else {
758758
Assertions.fail("Failing, Verify credentials");
759759
}
@@ -769,7 +769,7 @@ void testIncludeSchemaCheck() {
769769
@Override
770770
public void onCompletion(ResponseType responseType, QueryResult queryresult, Error error) {
771771
if (error == null) {
772-
Assertions.assertEquals(27, queryresult.getResultObjects().size());
772+
Assertions.assertEquals(28, queryresult.getResultObjects().size());
773773
} else {
774774
Assertions.fail("Failing, Verify credentials");
775775
}
@@ -787,7 +787,7 @@ void testIncludeContentType() {
787787
public void onCompletion(ResponseType responseType, QueryResult queryresult, Error error) {
788788
if (error == null) {
789789
List<Entry> entries = queryresult.getResultObjects();
790-
Assertions.assertEquals(27, entries.size());
790+
Assertions.assertEquals(28, entries.size());
791791
} else {
792792
Assertions.fail("Failing, Verify credentials");
793793
}

0 commit comments

Comments
 (0)