|
7 | 7 | import java.util.GregorianCalendar; |
8 | 8 | import java.util.logging.Logger; |
9 | 9 |
|
| 10 | +import static org.junit.Assert.assertEquals; |
| 11 | +import static org.junit.Assert.assertNull; |
10 | 12 | import static org.junit.jupiter.api.Assertions.assertTrue; |
11 | 13 |
|
12 | 14 | @TestInstance(TestInstance.Lifecycle.PER_CLASS) |
@@ -62,6 +64,50 @@ public void onCompletion(ResponseType responseType, Error error) { |
62 | 64 | }); |
63 | 65 | logger.info("passed.."); |
64 | 66 | } |
| 67 | + @Test |
| 68 | + void VariantsTestSingleUid(){ |
| 69 | + entry = stack.contentType(CONTENT_TYPE).entry(entryUid).variants(" cs672c33271558d8b0 "); |
| 70 | + entry.fetch(new EntryResultCallBack() { |
| 71 | + @Override |
| 72 | + public void onCompletion(ResponseType responseType, Error error) { |
| 73 | + assertEquals("cs672c33271558d8b0", entry.getHeaders().get("x-cs-variant-uid")); |
| 74 | + System.out.println(entry.toJSON()); |
| 75 | + } |
| 76 | + }); |
| 77 | + } |
| 78 | + @Test |
| 79 | + void VariantsTestArray(){ |
| 80 | + entry = stack.contentType(CONTENT_TYPE).entry(entryUid).variants(new String[]{" cs672c33271558d8b0"," cs321fbc07ec71861b"," cs321fbc07ec71861b "}); |
| 81 | + entry.fetch(new EntryResultCallBack() { |
| 82 | + @Override |
| 83 | + public void onCompletion(ResponseType responseType, Error error) { |
| 84 | + System.out.println(entry.toJSON()); |
| 85 | + } |
| 86 | + }); |
| 87 | + } |
| 88 | + |
| 89 | + @Test |
| 90 | + void VariantsTestArrayWithMixedElements() { |
| 91 | + entry = stack.contentType(CONTENT_TYPE).entry(entryUid).variants(new String[]{"", " cs672c33271558d8b0 ", null, " "}); |
| 92 | + entry.fetch(new EntryResultCallBack() { |
| 93 | + @Override |
| 94 | + public void onCompletion(ResponseType responseType, Error error) { |
| 95 | + System.out.println(entry.toJSON()); |
| 96 | + } |
| 97 | + }); |
| 98 | + } |
| 99 | + |
| 100 | + @Test |
| 101 | + void VariantsTestNullString() { |
| 102 | + entry = stack.contentType(CONTENT_TYPE).entry(entryUid).variants((String) null); |
| 103 | + entry.fetch(new EntryResultCallBack() { |
| 104 | + @Override |
| 105 | + public void onCompletion(ResponseType responseType, Error error) { |
| 106 | + assertNull(entry.getHeaders().get("x-cs-variant-uid")); |
| 107 | + System.out.println(entry.toJSON()); |
| 108 | + } |
| 109 | + }); |
| 110 | + } |
65 | 111 |
|
66 | 112 | @Test |
67 | 113 | @Order(4) |
|
0 commit comments