diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/business/bo/DataSetTableTest.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/business/bo/DataSetTableTest.java
index b640b92556b7a6738385d210efac83a7ebb5f261..d1026a78d78be1b66661ee9c9cd242393ba46416 100644
--- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/business/bo/DataSetTableTest.java
+++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/business/bo/DataSetTableTest.java
@@ -27,6 +27,8 @@ import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collections;
 import java.util.List;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
 
 import org.apache.commons.lang.StringUtils;
 import org.hamcrest.BaseMatcher;
@@ -288,10 +290,18 @@ public final class DataSetTableTest extends AbstractBOTest
             fail("UserFailureException expected");
         } catch (UserFailureException e)
         {
+            Pattern pattern =
+                    Pattern.compile("Deletion failed because the following data sets are "
+                            + "required by a background process \\(their status is pending\\): "
+                            +"\\[(.*)\\]. ");
+            Matcher matcher = pattern.matcher(e.getMessage());
 
-            assertEquals("Deletion failed because the following data sets are "
-                    + "required by a background process (their status is pending): "
-                    + "[d4n, d5n]. ", e.getMessage());
+            assertTrue("Invalid error message:" + e.getMessage(), matcher.matches());
+
+            List<String> pendingIds = Arrays.asList(matcher.group(1).split(", "));
+            Collections.sort(pendingIds);
+
+            assertEquals("[d4n, d5n]", pendingIds.toString());
         }
     }