@@ -713,24 +713,23 @@ public void updateNonExistingDocument() {
713
713
714
714
@ Test
715
715
public void updateDocumentPreconditionFailed () {
716
- final BaseDocument doc = new BaseDocument ();
717
- doc .addAttribute ("a" , "test" );
718
- doc .addAttribute ("c" , "test" );
716
+ final BaseDocument doc = new BaseDocument ("test-" + UUID .randomUUID ().toString ());
717
+ doc .addAttribute ("foo" , "a" );
719
718
final DocumentCreateEntity <BaseDocument > createResult = db .collection (COLLECTION_NAME )
720
719
.insertDocument (doc , null );
721
720
722
- doc .updateAttribute ("a" , "test1" );
723
- doc .addAttribute ("b" , "test" );
724
- doc .updateAttribute ("c" , null );
725
- final DocumentUpdateEntity <BaseDocument > updateResult = db .collection (COLLECTION_NAME )
726
- .updateDocument (createResult .getKey (), doc , null );
721
+ doc .updateAttribute ("foo" , "b" );
722
+ db .collection (COLLECTION_NAME ).updateDocument (doc .getKey (), doc , null );
727
723
724
+ doc .updateAttribute ("foo" , "c" );
728
725
try {
729
- db .collection (COLLECTION_NAME ).updateDocument (createResult .getKey (), doc , new DocumentUpdateOptions ().ifMatch (createResult .getRev ()));
726
+ db .collection (COLLECTION_NAME ).updateDocument (doc .getKey (), doc , new DocumentUpdateOptions ().ifMatch (createResult .getRev ()));
730
727
} catch (ArangoDBException e ) {
731
728
assertThat (e .getResponseCode (), is (412 ));
732
729
assertThat (e .getErrorNum (), is (1200 ));
733
730
}
731
+ BaseDocument readDocument = db .collection (COLLECTION_NAME ).getDocument (doc .getKey (), BaseDocument .class );
732
+ assertThat (readDocument .getAttribute ("foo" ), is ("b" ));
734
733
}
735
734
736
735
@ Test
0 commit comments