Skip to content

Commit 728a854

Browse files
committed
feat : variants implementation
1 parent 053a71b commit 728a854

File tree

1 file changed

+44
-0
lines changed

1 file changed

+44
-0
lines changed

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

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,50 @@ public void onCompletion(ResponseType responseType, Error error) {
6666
});
6767
logger.info("passed..");
6868
}
69+
@Test
70+
void VariantsTestSingleUid(){
71+
entry = stack.contentType(CONTENT_TYPE).entry(entryUid).variants(" cs672c33271558d8b0 ");
72+
entry.fetch(new EntryResultCallBack() {
73+
@Override
74+
public void onCompletion(ResponseType responseType, Error error) {
75+
assertEquals("cs672c33271558d8b0", entry.getHeaders().get("x-cs-variant-uid"));
76+
System.out.println(entry.toJSON());
77+
}
78+
});
79+
}
80+
@Test
81+
void VariantsTestArray(){
82+
entry = stack.contentType(CONTENT_TYPE).entry(entryUid).variants(new String[]{" cs672c33271558d8b0"," cs321fbc07ec71861b"," cs321fbc07ec71861b "});
83+
entry.fetch(new EntryResultCallBack() {
84+
@Override
85+
public void onCompletion(ResponseType responseType, Error error) {
86+
System.out.println(entry.toJSON());
87+
}
88+
});
89+
}
90+
91+
@Test
92+
void VariantsTestArrayWithMixedElements() {
93+
entry = stack.contentType(CONTENT_TYPE).entry(entryUid).variants(new String[]{"", " cs672c33271558d8b0 ", null, " "});
94+
entry.fetch(new EntryResultCallBack() {
95+
@Override
96+
public void onCompletion(ResponseType responseType, Error error) {
97+
System.out.println(entry.toJSON());
98+
}
99+
});
100+
}
101+
102+
@Test
103+
void VariantsTestNullString() {
104+
entry = stack.contentType(CONTENT_TYPE).entry(entryUid).variants((String) null);
105+
entry.fetch(new EntryResultCallBack() {
106+
@Override
107+
public void onCompletion(ResponseType responseType, Error error) {
108+
assertNull(entry.getHeaders().get("x-cs-variant-uid"));
109+
System.out.println(entry.toJSON());
110+
}
111+
});
112+
}
69113

70114
@Test
71115
void VariantsTestSingleUid() {

0 commit comments

Comments
 (0)