--- /dev/null
+package org.simantics.db.tests.api.delayedWrite;
+
+import org.junit.Test;
+import org.simantics.db.Resource;
+import org.simantics.db.WriteGraph;
+import org.simantics.db.common.request.DelayedWriteRequest;
+import org.simantics.db.exception.DatabaseException;
+import org.simantics.db.testing.annotation.Fails;
+import org.simantics.db.testing.base.ExistingDatabaseTest;
+
+/**
+ * This originated from Apros issue #3296.
+ *
+ * @author Tuukka Lehtonen
+ */
+public class DelayedWriteGraphExceptionHandling extends ExistingDatabaseTest {
+
+ @Test
+ public void test() throws Exception {
+ try {
+ DelayedWriteRequest r = new DelayedWriteRequest() {
+ @Override
+ public void perform(WriteGraph graph) throws DatabaseException {
+ // Should throw an exception / error
+ graph.claim(null, null, null, null);
+ }
+ };
+ getSession().sync(r);
+ } catch (DatabaseException e) {
+ // Should happen.
+ }
+
+ // Just to check the database session is still alive.
+ Resource r = getSession().sync(new org.simantics.db.common.primitiverequest.Resource("http:/"));
+
+ }
+
+}