Skip to content

Commit d0fcc9c

Browse files
committed
documentKeyWithSpecialChars tests
1 parent 5e4446b commit d0fcc9c

File tree

3 files changed

+41
-0
lines changed

3 files changed

+41
-0
lines changed

src/test/java/com/arangodb/ArangoEdgeCollectionTest.java

+17
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929

3030
import java.util.Arrays;
3131
import java.util.Collections;
32+
import java.util.UUID;
3233

3334
import static org.hamcrest.MatcherAssert.assertThat;
3435
import static org.hamcrest.Matchers.*;
@@ -437,4 +438,20 @@ public void deleteEdgeIfMatchFail() {
437438
}
438439
}
439440
}
441+
442+
@Test
443+
public void edgeKeyWithSpecialChars() {
444+
final BaseEdgeDocument value = createEdgeValue();
445+
final String key = "_-:.@()+,=;$!*'%" + UUID.randomUUID().toString();
446+
value.setKey(key);
447+
final EdgeEntity edge = edges.insertEdge(value, null);
448+
assertThat(edge, is(notNullValue()));
449+
final BaseEdgeDocument document = edgeCollection.getDocument(edge.getKey(),
450+
BaseEdgeDocument.class, null);
451+
assertThat(document, is(notNullValue()));
452+
assertThat(document.getKey(), is(key));
453+
assertThat(document.getFrom(), is(notNullValue()));
454+
assertThat(document.getTo(), is(notNullValue()));
455+
}
456+
440457
}

src/test/java/com/arangodb/ArangoVertexCollectionTest.java

+13
Original file line numberDiff line numberDiff line change
@@ -459,4 +459,17 @@ public void deleteVertexIfMatchFail() {
459459
}
460460
}
461461
}
462+
463+
@Test
464+
public void vertexKeyWithSpecialChars() {
465+
final String key = "_-:.@()+,=;$!*'%" + UUID.randomUUID().toString();
466+
final VertexEntity vertex = vertices
467+
.insertVertex(new BaseDocument(key), null);
468+
assertThat(vertex, is(notNullValue()));
469+
final BaseDocument document = collection
470+
.getDocument(vertex.getKey(), BaseDocument.class, null);
471+
assertThat(document, is(notNullValue()));
472+
assertThat(document.getKey(), is(key));
473+
}
474+
462475
}

src/test/java/com/arangodb/DocumentTest.java

+11
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
import org.junit.runners.Parameterized;
2929

3030
import java.util.Map;
31+
import java.util.UUID;
3132

3233
import static org.hamcrest.MatcherAssert.assertThat;
3334
import static org.hamcrest.Matchers.is;
@@ -121,4 +122,14 @@ public void insertAsBaseDocument() {
121122
assertThat(artist.toString(), is("PREGARDIEN/RHEINISCHE KANTOREI/DAS"));
122123
}
123124

125+
@Test
126+
public void documentKeyWithSpecialChars() {
127+
final String key = "_-:.@()+,=;$!*'%" + UUID.randomUUID().toString();
128+
final BaseDocument document = new BaseDocument(key);
129+
final DocumentCreateEntity<BaseDocument> createResult = collection.insertDocument(document);
130+
final BaseDocument doc = collection.getDocument(createResult.getKey(), BaseDocument.class);
131+
assertThat(doc, is(notNullValue()));
132+
assertThat(doc.getKey(), is(key));
133+
}
134+
124135
}

0 commit comments

Comments
 (0)