@@ -713,24 +713,23 @@ public void updateNonExistingDocument() {
713713
714714 @ Test
715715 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" );
719718 final DocumentCreateEntity <BaseDocument > createResult = db .collection (COLLECTION_NAME )
720719 .insertDocument (doc , null );
721720
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 );
727723
724+ doc .updateAttribute ("foo" , "c" );
728725 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 ()));
730727 } catch (ArangoDBException e ) {
731728 assertThat (e .getResponseCode (), is (412 ));
732729 assertThat (e .getErrorNum (), is (1200 ));
733730 }
731+ BaseDocument readDocument = db .collection (COLLECTION_NAME ).getDocument (doc .getKey (), BaseDocument .class );
732+ assertThat (readDocument .getAttribute ("foo" ), is ("b" ));
734733 }
735734
736735 @ Test
0 commit comments