diff --git a/src/main/java/de/bps/onyx/plugin/OnyxModule.java b/src/main/java/de/bps/onyx/plugin/OnyxModule.java
index af5ef3a7d164def770e095addecd41457b021337..4c5e0ac23012e4baa6add4d4b2a83253f4e5de58 100644
--- a/src/main/java/de/bps/onyx/plugin/OnyxModule.java
+++ b/src/main/java/de/bps/onyx/plugin/OnyxModule.java
@@ -372,7 +372,7 @@ public class OnyxModule extends AbstractSpringModule implements ConfigOnOff {
 		List<QTIResultSet> resultSets = qrm.getResultSets(courseResourceableId, courseNode.getIdent(), courseNode.getReferencedRepositoryEntry().getKey(),
 				identity);
 		for (QTIResultSet resultSet : resultSets) {
-			if(resultSet.getAssessmentID() == assessmentId && !resultSet.getSuspended()) {
+			if(Long.valueOf(resultSet.getAssessmentID()).equals(assessmentId) && !resultSet.getSuspended()) {
 				return true;
 			}
 		}
diff --git a/src/test/java/de/bps/onyx/plugin/OnyxModuleTest.java b/src/test/java/de/bps/onyx/plugin/OnyxModuleTest.java
new file mode 100644
index 0000000000000000000000000000000000000000..682c11fe5ab7899d885784e47f87cbe23e71392c
--- /dev/null
+++ b/src/test/java/de/bps/onyx/plugin/OnyxModuleTest.java
@@ -0,0 +1,76 @@
+/**
+ * <a href="http://www.openolat.org">
+ * OpenOLAT - Online Learning and Training</a><br>
+ * <p>
+ * Licensed under the Apache License, Version 2.0 (the "License"); <br>
+ * you may not use this file except in compliance with the License.<br>
+ * You may obtain a copy of the License at the
+ * <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache homepage</a>
+ * <p>
+ * Unless required by applicable law or agreed to in writing,<br>
+ * software distributed under the License is distributed on an "AS IS" BASIS, <br>
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. <br>
+ * See the License for the specific language governing permissions and <br>
+ * limitations under the License.
+ * <p>
+ * Initial code contributed and copyrighted by<br>
+ * frentix GmbH, http://www.frentix.com
+ * <p>
+ */
+package de.bps.onyx.plugin;
+
+import static org.olat.modules.iq.IQTestHelper.createRepository;
+import static org.olat.modules.iq.IQTestHelper.createSet;
+import static org.olat.modules.iq.IQTestHelper.modDate;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.olat.core.commons.persistence.DB;
+import org.olat.core.id.Identity;
+import org.olat.course.nodes.IQTESTCourseNode;
+import org.olat.course.nodes.QTICourseNode;
+import org.olat.course.nodes.iq.IQEditController;
+import org.olat.ims.qti.QTIResultSet;
+import org.olat.repository.RepositoryEntry;
+import org.olat.test.JunitTestHelper;
+import org.olat.test.OlatTestCase;
+import org.springframework.beans.factory.annotation.Autowired;
+
+/**
+ * 
+ * Initial date: 20 janv. 2017<br>
+ * @author srosse, stephane.rosse@frentix.com, http://www.frentix.com
+ *
+ */
+public class OnyxModuleTest extends OlatTestCase {
+	
+	@Autowired
+	private DB dbInstance;
+	
+	@Test
+	public void existsResultSet() {
+		RepositoryEntry re = createRepository();
+		Identity id = JunitTestHelper.createAndPersistIdentityAsRndUser("qti-result-mgr-1");
+		dbInstance.commit();
+		
+		long assessmentId = 838l;
+		String resSubPath = "qtiResult34";
+		QTIResultSet set = createSet(1.0f, assessmentId, id, re, resSubPath, modDate(3, 8, 5), modDate(3, 8, 20));
+		dbInstance.commit();
+		Assert.assertNotNull(set);
+		
+		// fake the course node
+		QTICourseNode courseNode = new IQTESTCourseNode();
+		courseNode.setIdent(resSubPath);
+		IQEditController.setIQReference(re, courseNode.getModuleConfiguration());
+
+		boolean foundIt = OnyxModule.existsResultSet(re.getOlatResource().getResourceableId(), courseNode, id, assessmentId);
+		Assert.assertTrue(foundIt);
+		
+		boolean notFoundIt = OnyxModule.existsResultSet(re.getOlatResource().getResourceableId(), courseNode, id, null);
+		Assert.assertFalse(notFoundIt);
+		
+		boolean notFoundItAlt = OnyxModule.existsResultSet(re.getOlatResource().getResourceableId(), courseNode, id, -123l);
+		Assert.assertFalse(notFoundItAlt);
+	}
+}
diff --git a/src/test/java/org/olat/test/AllTestsJunit4.java b/src/test/java/org/olat/test/AllTestsJunit4.java
index abf2bcbeb834f3bcc9a04b11ec001f7ff7433bf6..4ee2bf8ccd33a8cff04a47ffc2ed7eef4b886487 100644
--- a/src/test/java/org/olat/test/AllTestsJunit4.java
+++ b/src/test/java/org/olat/test/AllTestsJunit4.java
@@ -276,6 +276,7 @@ import org.junit.runners.Suite;
 	org.olat.restapi.SystemTest.class,
 	org.olat.restapi.ChangePasswordTest.class,
 	org.olat.restapi.RegistrationTest.class,
+	de.bps.onyx.plugin.OnyxModuleTest.class,
 	de.bps.olat.portal.institution.InstitutionPortletTest.class,
 	org.olat.group.manager.BusinessGroupImportExportXStreamTest.class,
 	org.olat.group.test.BusinessGroupImportExportTest.class,