Skip to content
This repository was archived by the owner on Mar 10, 2022. It is now read-only.

Commit 5b3cc3f

Browse files
author
hideki
committed
Fixed #783 - ClassCastException
- Add simple test in case type is String and non-String
1 parent cdea8e6 commit 5b3cc3f

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

src/androidTest/java/com/couchbase/lite/DatabaseTest.java

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
import java.io.ByteArrayInputStream;
1414
import java.io.File;
1515
import java.net.URL;
16+
import java.util.ArrayList;
1617
import java.util.Arrays;
1718
import java.util.HashMap;
1819
import java.util.List;
@@ -407,4 +408,25 @@ public void testAttachmentsWithEncryption() throws Exception {
407408
setEncryptedAttachmentStore(false);
408409
}
409410
}
411+
412+
// https://github.com/couchbase/couchbase-lite-android/issues/783
413+
public void testNonStringForTypeField() throws CouchbaseLiteException {
414+
// Non String as type
415+
List<Integer> type1 = new ArrayList();
416+
type1.add(0);
417+
type1.add(1);
418+
Map<String, Object> props1 = new HashMap<String, Object>();
419+
props1.put("key", "value");
420+
props1.put("type", type1);
421+
Document doc1 = database.createDocument();
422+
doc1.putProperties(props1);
423+
424+
// String as type
425+
String type2 = "STRING";
426+
Map<String, Object> props2 = new HashMap<String, Object>();
427+
props1.put("key", "value");
428+
props1.put("type", type2);
429+
Document doc2 = database.createDocument();
430+
doc2.putProperties(props1);
431+
}
410432
}

0 commit comments

Comments
 (0)