cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aadamc...@apache.org
Subject svn commit: r1073769 - in /cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/access: CustomQueryTest.java DataContextTest.java MockNoRoutingQuery.java
Date Wed, 23 Feb 2011 15:11:33 GMT
Author: aadamchik
Date: Wed Feb 23 15:11:33 2011
New Revision: 1073769

URL: http://svn.apache.org/viewvc?rev=1073769&view=rev
Log:
tests cleanup

using mockito
aggregating one off tests

Removed:
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/access/CustomQueryTest.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/access/MockNoRoutingQuery.java
Modified:
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/access/DataContextTest.java

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/access/DataContextTest.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/access/DataContextTest.java?rev=1073769&r1=1073768&r2=1073769&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/access/DataContextTest.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/access/DataContextTest.java
Wed Feb 23 15:11:33 2011
@@ -19,6 +19,13 @@
 
 package org.apache.cayenne.access;
 
+import static org.mockito.Matchers.any;
+import static org.mockito.Matchers.eq;
+import static org.mockito.Matchers.isNull;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+
 import java.math.BigDecimal;
 import java.sql.Timestamp;
 import java.util.ArrayList;
@@ -39,9 +46,13 @@ import org.apache.cayenne.conn.PoolManag
 import org.apache.cayenne.di.Inject;
 import org.apache.cayenne.exp.Expression;
 import org.apache.cayenne.exp.ExpressionFactory;
+import org.apache.cayenne.map.EntityResolver;
 import org.apache.cayenne.query.EJBQLQuery;
 import org.apache.cayenne.query.ObjectIdQuery;
 import org.apache.cayenne.query.Ordering;
+import org.apache.cayenne.query.Query;
+import org.apache.cayenne.query.QueryMetadata;
+import org.apache.cayenne.query.QueryRouter;
 import org.apache.cayenne.query.SQLTemplate;
 import org.apache.cayenne.query.SelectQuery;
 import org.apache.cayenne.query.SortOrder;
@@ -364,6 +375,17 @@ public class DataContextTest extends Ser
                 objects.get(0) instanceof Artist);
     }
 
+    public void testPerformQuery_Routing() {
+        Query query = mock(Query.class);
+        QueryMetadata md = mock(QueryMetadata.class);
+        when(query.getMetaData(any(EntityResolver.class))).thenReturn(md);
+        context.performGenericQuery(query);
+        verify(query).route(
+                any(QueryRouter.class),
+                eq(context.getEntityResolver()),
+                (Query) isNull());
+    }
+
     public void testPerformNonSelectingQuery() throws Exception {
 
         createSingleArtistDataSet();



Mime
View raw message