camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hekon...@apache.org
Subject git commit: [CAMEL-7126] Added unit tests.
Date Wed, 15 Jan 2014 20:35:11 GMT
Updated Branches:
  refs/heads/master da80476dd -> dd5a50435


[CAMEL-7126] Added unit tests.


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/dd5a5043
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/dd5a5043
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/dd5a5043

Branch: refs/heads/master
Commit: dd5a5043545c0218fea1f65c0204174e38c8104b
Parents: da80476
Author: Henryk Konsek <hekonsek@gmail.com>
Authored: Wed Jan 15 21:34:52 2014 +0100
Committer: Henryk Konsek <hekonsek@gmail.com>
Committed: Wed Jan 15 21:34:52 2014 +0100

----------------------------------------------------------------------
 components/camel-bam/pom.xml                    |  5 +++
 .../apache/camel/bam/EntityManagersTest.java    | 42 ++++++++++++++++++++
 2 files changed, 47 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/dd5a5043/components/camel-bam/pom.xml
----------------------------------------------------------------------
diff --git a/components/camel-bam/pom.xml b/components/camel-bam/pom.xml
index bfb1d58..7f3a054 100644
--- a/components/camel-bam/pom.xml
+++ b/components/camel-bam/pom.xml
@@ -81,6 +81,11 @@
       <artifactId>junit</artifactId>
       <scope>test</scope>
     </dependency>
+      <dependency>
+          <groupId>org.mockito</groupId>
+          <artifactId>mockito-core</artifactId>
+          <scope>test</scope>
+      </dependency>
   </dependencies>
 
   <build>

http://git-wip-us.apache.org/repos/asf/camel/blob/dd5a5043/components/camel-bam/src/test/java/org/apache/camel/bam/EntityManagersTest.java
----------------------------------------------------------------------
diff --git a/components/camel-bam/src/test/java/org/apache/camel/bam/EntityManagersTest.java
b/components/camel-bam/src/test/java/org/apache/camel/bam/EntityManagersTest.java
new file mode 100644
index 0000000..67ee23c
--- /dev/null
+++ b/components/camel-bam/src/test/java/org/apache/camel/bam/EntityManagersTest.java
@@ -0,0 +1,42 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.bam;
+
+import javax.persistence.EntityManagerFactory;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+import static org.apache.camel.bam.EntityManagers.resolveEntityManager;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.verify;
+
+public class EntityManagersTest extends Assert {
+
+    @Test
+    public void shouldCreateNewEntityManagerIfThereIsNoTransaction() {
+        // Given
+        EntityManagerFactory entityManagerFactory = mock(EntityManagerFactory.class);
+
+        // When
+        resolveEntityManager(entityManagerFactory);
+
+        // Then
+        verify(entityManagerFactory).createEntityManager();
+    }
+
+}


Mime
View raw message