[jboss-svn-commits] JBL Code SVN: r28665 - labs/jbosstm/workspace/whitingjr/trunk/MVCCSampleSTM/src/test/java/uk/ac/ncl/sdia/a8905943/entitymanager.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Fri Jul 31 12:43:29 EDT 2009


Author: whitingjr
Date: 2009-07-31 12:43:28 -0400 (Fri, 31 Jul 2009)
New Revision: 28665

Added:
   labs/jbosstm/workspace/whitingjr/trunk/MVCCSampleSTM/src/test/java/uk/ac/ncl/sdia/a8905943/entitymanager/JUnitTestEntityManagerImpl.java
Log:
Test case to check the finding of an entity.

Added: labs/jbosstm/workspace/whitingjr/trunk/MVCCSampleSTM/src/test/java/uk/ac/ncl/sdia/a8905943/entitymanager/JUnitTestEntityManagerImpl.java
===================================================================
--- labs/jbosstm/workspace/whitingjr/trunk/MVCCSampleSTM/src/test/java/uk/ac/ncl/sdia/a8905943/entitymanager/JUnitTestEntityManagerImpl.java	                        (rev 0)
+++ labs/jbosstm/workspace/whitingjr/trunk/MVCCSampleSTM/src/test/java/uk/ac/ncl/sdia/a8905943/entitymanager/JUnitTestEntityManagerImpl.java	2009-07-31 16:43:28 UTC (rev 28665)
@@ -0,0 +1,42 @@
+/*
+ * JBoss, the OpenSource J2EE webOS
+ * 
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package uk.ac.ncl.sdia.a8905943.entitymanager;
+
+import junit.framework.Assert;
+
+import org.junit.Test;
+
+import uk.ac.ncl.sdia.a8905943.model.Car;
+
+
+public class JUnitTestEntityManagerImpl
+{
+
+   /**
+    * This test checks to make sure the construction of an entity works.
+    */
+   @Test
+   public void testCheckCreatingEntityWorks()
+   {
+      STMEntityManagerImpl entityManager = new STMEntityManagerImpl(null);
+      Long primaryKey = new Long(1);
+      Car carEntity = entityManager.find(Car.class, primaryKey);
+      
+      Assert.assertNotNull(carEntity);
+      Assert.assertEquals(primaryKey, carEntity.getId());
+   }
+
+   /*
+   @Test (expected=RuntimeException.class)
+   public void testCheckPrimaryKeyNotRightTypeThrowsException()
+   {
+      STMEntityManagerImpl entityManager = new STMEntityManagerImpl(null);
+      String primaryKey = "1";
+      Car carEntity = entityManager.find(Car.class, primaryKey);
+   }
+   */
+}



More information about the jboss-svn-commits mailing list