Permalink
Browse files

MODE-664 Upgraded Mockito to 1.8.1, which included changing several d…

…eprecations (via several search-replace activities that were well-documented in the deprecated classes and annotations in Mockito).

git-svn-id: https://svn.jboss.org/repos/modeshape/trunk@1658 76366958-4244-0410-ad5e-bbfabb93f86b
  • Loading branch information...
1 parent 6359627 commit b0d48bc3638a2749c19d398f77f85c848a1ccf0d Randall Hauch committed Feb 24, 2010
Showing with 267 additions and 269 deletions.
  1. +1 −1 docs/examples/gettingstarted/pom.xml
  2. +6 −6 ...tingstarted/repositories/src/test/java/org/modeshape/example/repository/RepositoryClientTest.java
  3. +1 −1 eclipse-preferences.epf
  4. +2 −2 ...-infinispan/src/test/java/org/modeshape/connector/infinispan/InfinispanConnectorReadableTest.java
  5. +2 −2 ...-infinispan/src/test/java/org/modeshape/connector/infinispan/InfinispanConnectorWritableTest.java
  6. +3 −3 ...e-connector-infinispan/src/test/java/org/modeshape/connector/infinispan/InfinispanSourceTest.java
  7. +2 −2 ...-jbosscache/src/test/java/org/modeshape/connector/jbosscache/JBossCacheConnectorReadableTest.java
  8. +2 −2 ...-jbosscache/src/test/java/org/modeshape/connector/jbosscache/JBossCacheConnectorWritableTest.java
  9. +4 −4 ...e-connector-jbosscache/src/test/java/org/modeshape/connector/jbosscache/JBossCacheSourceTest.java
  10. +3 −3 ...tor-jdbc-metadata/src/test/java/org/modeshape/connector/meta/jdbc/JdbcMetadataRepositoryTest.java
  11. +3 −3 ...nnector-jdbc-metadata/src/test/java/org/modeshape/connector/meta/jdbc/JdbcMetadataSourceTest.java
  12. +1 −1 ...ions/modeshape-connector-store-jpa/src/test/java/org/modeshape/connector/store/jpa/ModelTest.java
  13. +6 −6 ...nnector-store-jpa/src/test/java/org/modeshape/connector/store/jpa/model/basic/BasicModelTest.java
  14. +7 −9 ...ns/modeshape-connector-svn/src/test/java/org/modeshape/connector/svn/SvnRepositorySourceTest.java
  15. +9 −9 extensions/modeshape-search-lucene/src/test/java/org/modeshape/search/lucene/query/NotQueryTest.java
  16. +2 −2 extensions/modeshape-sequencer-zip/src/test/java/org/modeshape/sequencer/zip/ZipSequencerTest.java
  17. +3 −3 modeshape-graph/src/test/java/org/modeshape/graph/GraphTest.java
  18. +5 −5 ...va/org/modeshape/graph/connector/federation/AbstractFederatedRepositorySourceIntegrationTest.java
  19. +6 −6 ...aph/src/test/java/org/modeshape/graph/connector/federation/FederatedRepositoryConnectionTest.java
  20. +3 −3 ...e-graph/src/test/java/org/modeshape/graph/connector/federation/FederatedRepositorySourceTest.java
  21. +4 −4 modeshape-graph/src/test/java/org/modeshape/graph/connector/federation/FederatedRepositoryTest.java
  22. +1 −1 modeshape-graph/src/test/java/org/modeshape/graph/connector/federation/FederatedRequestTest.java
  23. +7 −7 modeshape-graph/src/test/java/org/modeshape/graph/connector/federation/FederatedWorkspaceTest.java
  24. +16 −16 modeshape-graph/src/test/java/org/modeshape/graph/connector/federation/ForkRequestProcessorTest.java
  25. +5 −5 modeshape-graph/src/test/java/org/modeshape/graph/connector/federation/JoinRequestProcessorTest.java
  26. +26 −26 modeshape-graph/src/test/java/org/modeshape/graph/connector/federation/ProjectionTest.java
  27. +3 −3 modeshape-graph/src/test/java/org/modeshape/graph/io/GraphImporterTest.java
  28. +3 −3 modeshape-graph/src/test/java/org/modeshape/graph/property/basic/AbstractPathTest.java
  29. +16 −16 modeshape-graph/src/test/java/org/modeshape/graph/property/basic/ChildPathTest.java
  30. +12 −12 modeshape-graph/src/test/java/org/modeshape/graph/property/basic/RootPathTest.java
  31. +1 −1 modeshape-graph/src/test/java/org/modeshape/graph/query/process/QueryResultColumnsTest.java
  32. +3 −3 modeshape-graph/src/test/java/org/modeshape/graph/request/CompositeRequestChannelTest.java
  33. +6 −6 modeshape-graph/src/test/java/org/modeshape/graph/search/SearchableRepositorySourceTest.java
  34. +1 −1 modeshape-jcr/src/test/java/org/modeshape/jcr/AbstractJcrItemTest.java
  35. +17 −17 modeshape-jcr/src/test/java/org/modeshape/jcr/AbstractJcrNodeTest.java
  36. +17 −17 modeshape-jcr/src/test/java/org/modeshape/jcr/AbstractJcrPropertyTest.java
  37. +7 −7 modeshape-jcr/src/test/java/org/modeshape/jcr/AbstractJcrTest.java
  38. +12 −12 modeshape-jcr/src/test/java/org/modeshape/jcr/AbstractSessionTest.java
  39. +3 −3 modeshape-jcr/src/test/java/org/modeshape/jcr/CndNodeTypeRegistrationTest.java
  40. +9 −9 modeshape-jcr/src/test/java/org/modeshape/jcr/JcrMultiValuePropertyTest.java
  41. +1 −1 modeshape-jcr/src/test/java/org/modeshape/jcr/JcrNamespaceRegistryTest.java
  42. +6 −6 modeshape-jcr/src/test/java/org/modeshape/jcr/JcrSessionTest.java
  43. +1 −1 modeshape-jcr/src/test/java/org/modeshape/jcr/JcrValueTest.java
  44. +11 −11 modeshape-jcr/src/test/java/org/modeshape/jcr/WorkspaceLockManagerTest.java
  45. +4 −4 modeshape-repository/src/test/java/org/modeshape/repository/ModeShapeEngineTest.java
  46. +3 −3 modeshape-repository/src/test/java/org/modeshape/repository/RepositoryServiceTest.java
  47. +1 −1 pom.xml
@@ -94,7 +94,7 @@
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
- <version>1.5</version>
+ <version>1.8.1</version>
<scope>test</scope>
</dependency>
</dependencies>
@@ -26,7 +26,7 @@
import static org.hamcrest.core.Is.is;
import static org.junit.Assert.assertThat;
import static org.junit.matchers.IsCollectionContaining.hasItems;
-import static org.mockito.Mockito.stub;
+import static org.mockito.Mockito.when;
import java.io.File;
import java.util.ArrayList;
import java.util.HashMap;
@@ -41,7 +41,7 @@
import org.junit.Ignore;
import org.junit.Test;
import org.mockito.MockitoAnnotations;
-import org.mockito.MockitoAnnotations.Mock;
+import org.mockito.Mock;
/**
* @author Randall Hauch
@@ -64,9 +64,9 @@ public void beforeEach() {
client = new RepositoryClient();
client.setUserInterface(userInterface);
client.setApi(getApi());
- stub(userInterface.getLocationOfRepositoryFiles()).toReturn(new File("src/main/resources").getAbsolutePath());
- stub(userInterface.getLocationOfCndFiles()).toReturn(new File("src/main/resources").getAbsolutePath());
- stub(userInterface.getRepositoryConfiguration()).toReturn(new File("src/main/resources/configRepository.xml"));
+ when(userInterface.getLocationOfRepositoryFiles()).thenReturn(new File("src/main/resources").getAbsolutePath());
+ when(userInterface.getLocationOfCndFiles()).thenReturn(new File("src/main/resources").getAbsolutePath());
+ when(userInterface.getRepositoryConfiguration()).thenReturn(new File("src/main/resources/configRepository.xml"));
// Set up the JAAS provider (IDTrust) and a policy file (which defines the "modeshape-jcr" login config name)
IDTrustConfiguration idtrustConfig = new IDTrustConfiguration();
@@ -77,7 +77,7 @@ public void beforeEach() {
}
CallbackHandler handler = new JaasSecurityContext.UserPasswordCallbackHandler("jsmith", "secret".toCharArray());
- stub(userInterface.getCallbackHandler()).toReturn(handler);
+ when(userInterface.getCallbackHandler()).thenReturn(handler);
}
@After
View
@@ -74,7 +74,7 @@ file_export_version=3.0
/instance/org.eclipse.jdt.core/org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
/instance/org.eclipse.jdt.core/org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
/instance/org.eclipse.jdt.core/org.eclipse.jdt.core.compiler.source=1.6
-/instance/org.eclipse.jdt.ui/content_assist_favorite_static_members=org.junit.Assert.*;org.hamcrest.core.IsEqual.*;org.junit.matchers.JUnitMatchers.*;org.hamcrest.core.AllOf.*;org.hamcrest.core.AnyOf.*;org.hamcrest.core.IsInstanceOf.*;org.hamcrest.core.IsNot.*;org.hamcrest.core.IsNull.*;org.hamcrest.core.IsSame.*;org.hamcrest.core.DescribedAs.*;org.junit.matchers.IsCollectionContaining.*;org.junit.matchers.StringContains.*;org.hamcrest.core.Is.is;org.hamcrest.core.IsNot.not;org.hamcrest.core.IsNull.nullValue;org.hamcrest.core.IsNull.notNullValue;org.hamcrest.core.IsSame.sameInstance;org.hamcrest.core.IsInstanceOf.instanceOf;org.hamcrest.core.IsEqual.equalTo;org.hamcrest.core.IsAnything.anything;org.hamcrest.core.IsAnything.any;org.hamcrest.core.DescribedAs.describedAs;org.hamcrest.core.AnyOf.anyOf;org.hamcrest.core.AllOf.allOf;org.junit.matchers.IsCollectionContaining.hasItem;org.junit.matchers.IsCollectionContaining.hasItems;org.junit.matchers.Each.each;org.junit.matchers.JUnitMatchers.hasItem;org.junit.matchers.JUnitMatchers.hasItems;org.junit.matchers.JUnitMatchers.containsString;org.junit.matchers.JUnitMatchers.each;org.junit.matchers.JUnitMatchers.both;org.junit.matchers.JUnitMatchers.either;org.junit.matchers.StringContains.containsString;org.junit.matchers.TypeSafeMatcher.matches;org.hamcrest.collection.IsArray.*;org.hamcrest.collection.IsArrayContaining.*;org.hamcrest.number.IsCloseTo.*;org.mockito.Mockito.mock;org.mockito.Mockito.stub;org.mockito.Mockito.verify;org.mockito.Mockito.atLeastOnce;org.mockito.Mockito.inOrder;org.mockito.Mockito.never;org.mockito.Mockito.stubVoid;org.mockito.Mockito.times;org.mockito.Matchers;org.mockito.Matchers.anyBoolean;org.mockito.Matchers.anyByte;org.mockito.Matchers.anyChar;org.mockito.Matchers.anyDouble;org.mockito.Matchers.anyFloat;org.mockito.Matchers.anyInt;org.mockito.Matchers.anyLong;org.mockito.Matchers.anyObject;org.mockito.Matchers.anyShort;org.mockito.Matchers.anyString;org.mockito.Matchers.argThat;org.mockito.Matchers.booleanThat;org.mockito.Matchers.byteThat;org.mockito.Matchers.charThat;org.mockito.Matchers.contains;org.mockito.Matchers.doubleThat;org.mockito.Matchers.endsWith;org.mockito.Matchers.eq;org.mockito.Matchers.floatThat;org.mockito.Matchers.intThat;org.mockito.Matchers.isA;org.mockito.Matchers.isNull;org.mockito.Matchers.longThat;org.mockito.Matchers.matches;org.mockito.Matchers.notNull;org.mockito.Matchers.refEq;org.mockito.Matchers.same;org.mockito.Matchers.shortThat;org.mockito.Matchers.startsWith;org.modeshape.common.text.StringMatcher.startsWith;org.modeshape.graph.connectors.RepositorySourceLoadHarness.runLoadTest;org.mockito.Mockito.verifyNoMoreInteractions;org.mockito.Mockito.verifyZeroInteractions;org.modeshape.common.collection.IsIteratorContaining.hasItems;org.modeshape.common.collection.IsIteratorContaining.hasItem.*;org.mockito.Mockito.doReturn;org.mockito.Mockito.doThrow;org.mockito.Mockito.doAnswer;org.mockito.Mockito.doNothing;org.mockito.Mockito.anyList;org.mockito.Mockito.anyMap;org.mockito.Mockito.anyCollection;org.mockito.Mockito.spy
+/instance/org.eclipse.jdt.ui/content_assist_favorite_static_members=org.junit.Assert.*;org.hamcrest.core.IsEqual.*;org.junit.matchers.JUnitMatchers.*;org.hamcrest.core.AllOf.*;org.hamcrest.core.AnyOf.*;org.hamcrest.core.IsInstanceOf.*;org.hamcrest.core.IsNot.*;org.hamcrest.core.IsNull.*;org.hamcrest.core.IsSame.*;org.hamcrest.core.DescribedAs.*;org.junit.matchers.IsCollectionContaining.*;org.junit.matchers.StringContains.*;org.hamcrest.core.Is.is;org.hamcrest.core.IsNot.not;org.hamcrest.core.IsNull.nullValue;org.hamcrest.core.IsNull.notNullValue;org.hamcrest.core.IsSame.sameInstance;org.hamcrest.core.IsInstanceOf.instanceOf;org.hamcrest.core.IsEqual.equalTo;org.hamcrest.core.IsAnything.anything;org.hamcrest.core.IsAnything.any;org.hamcrest.core.DescribedAs.describedAs;org.hamcrest.core.AnyOf.anyOf;org.hamcrest.core.AllOf.allOf;org.junit.matchers.IsCollectionContaining.hasItem;org.junit.matchers.IsCollectionContaining.hasItems;org.junit.matchers.Each.each;org.junit.matchers.JUnitMatchers.hasItem;org.junit.matchers.JUnitMatchers.hasItems;org.junit.matchers.JUnitMatchers.containsString;org.junit.matchers.JUnitMatchers.each;org.junit.matchers.JUnitMatchers.both;org.junit.matchers.JUnitMatchers.either;org.junit.matchers.StringContains.containsString;org.junit.matchers.TypeSafeMatcher.matches;org.hamcrest.collection.IsArray.*;org.hamcrest.collection.IsArrayContaining.*;org.hamcrest.number.IsCloseTo.*;org.mockito.Mockito.mock;org.mockito.Mockito.when;org.mockito.Mockito.verify;org.mockito.Mockito.atLeastOnce;org.mockito.Mockito.inOrder;org.mockito.Mockito.never;org.mockito.Mockito.stubVoid;org.mockito.Mockito.times;org.mockito.Matchers;org.mockito.Matchers.anyBoolean;org.mockito.Matchers.anyByte;org.mockito.Matchers.anyChar;org.mockito.Matchers.anyDouble;org.mockito.Matchers.anyFloat;org.mockito.Matchers.anyInt;org.mockito.Matchers.anyLong;org.mockito.Matchers.anyObject;org.mockito.Matchers.anyShort;org.mockito.Matchers.anyString;org.mockito.Matchers.argThat;org.mockito.Matchers.booleanThat;org.mockito.Matchers.byteThat;org.mockito.Matchers.charThat;org.mockito.Matchers.contains;org.mockito.Matchers.doubleThat;org.mockito.Matchers.endsWith;org.mockito.Matchers.eq;org.mockito.Matchers.floatThat;org.mockito.Matchers.intThat;org.mockito.Matchers.isA;org.mockito.Matchers.isNull;org.mockito.Matchers.longThat;org.mockito.Matchers.matches;org.mockito.Matchers.notNull;org.mockito.Matchers.refEq;org.mockito.Matchers.same;org.mockito.Matchers.shortThat;org.mockito.Matchers.startsWith;org.modeshape.common.text.StringMatcher.startsWith;org.modeshape.graph.connectors.RepositorySourceLoadHarness.runLoadTest;org.mockito.Mockito.verifyNoMoreInteractions;org.mockito.Mockito.verifyZeroInteractions;org.modeshape.common.collection.IsIteratorContaining.hasItems;org.modeshape.common.collection.IsIteratorContaining.hasItem.*;org.mockito.Mockito.doReturn;org.mockito.Mockito.doThrow;org.mockito.Mockito.doAnswer;org.mockito.Mockito.doNothing;org.mockito.Mockito.anyList;org.mockito.Mockito.anyMap;org.mockito.Mockito.anyCollection;org.mockito.Mockito.spy
/instance/org.eclipse.jdt.ui/org.eclipse.jdt.ui.gettersetter.use.is=true
/instance/org.eclipse.jdt.ui/org.eclipse.jdt.ui.ignorelowercasenames=true
/instance/org.eclipse.jdt.ui/org.eclipse.jdt.ui.importorder=\#;java;javax;org;com;
@@ -2,7 +2,7 @@
import static org.mockito.Matchers.anyString;
import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.stub;
+import static org.mockito.Mockito.when;
import java.io.File;
import java.io.IOException;
import javax.naming.Context;
@@ -33,7 +33,7 @@ protected RepositorySource setUpSource() throws NamingException {
// Set up the mock JNDI ...
mockJndi = mock(Context.class);
- stub(mockJndi.lookup(anyString())).toReturn(null);
+ when(mockJndi.lookup(anyString())).thenReturn(null);
source.setContext(mockJndi);
return source;
@@ -2,7 +2,7 @@
import static org.mockito.Matchers.anyString;
import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.stub;
+import static org.mockito.Mockito.when;
import java.io.IOException;
import javax.naming.Context;
import javax.naming.NamingException;
@@ -31,7 +31,7 @@ protected RepositorySource setUpSource() throws NamingException {
// Set up the mock JNDI ...
mockJndi = mock(Context.class);
- stub(mockJndi.lookup(anyString())).toReturn(null);
+ when(mockJndi.lookup(anyString())).thenReturn(null);
source.setContext(mockJndi);
Graph graph = Graph.create(source, context);
@@ -28,7 +28,7 @@
import static org.hamcrest.core.IsNull.nullValue;
import static org.junit.Assert.assertThat;
import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.stub;
+import static org.mockito.Mockito.when;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.Hashtable;
@@ -47,7 +47,7 @@
import org.junit.Before;
import org.junit.Test;
import org.mockito.MockitoAnnotations;
-import org.mockito.MockitoAnnotations.Mock;
+import org.mockito.Mock;
/**
*/
@@ -75,7 +75,7 @@ public void beforeEach() throws Exception {
// Set up the fake JNDI context ...
source.setContext(jndiContext);
- stub(jndiContext.lookup(validCacheManagerJndiName)).toReturn(cacheManager);
+ when(jndiContext.lookup(validCacheManagerJndiName)).thenReturn(cacheManager);
}
@After
@@ -25,7 +25,7 @@
import static org.mockito.Matchers.anyString;
import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.stub;
+import static org.mockito.Mockito.when;
import java.io.File;
import java.io.IOException;
import javax.naming.Context;
@@ -59,7 +59,7 @@ protected RepositorySource setUpSource() throws NamingException {
// Set up the mock JNDI ...
mockJndi = mock(Context.class);
- stub(mockJndi.lookup(anyString())).toReturn(null);
+ when(mockJndi.lookup(anyString())).thenReturn(null);
source.setContext(mockJndi);
return source;
@@ -25,7 +25,7 @@
import static org.mockito.Matchers.anyString;
import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.stub;
+import static org.mockito.Mockito.when;
import java.io.IOException;
import javax.naming.Context;
import javax.naming.NamingException;
@@ -57,7 +57,7 @@ protected RepositorySource setUpSource() throws NamingException {
// Set up the mock JNDI ...
mockJndi = mock(Context.class);
- stub(mockJndi.lookup(anyString())).toReturn(null);
+ when(mockJndi.lookup(anyString())).thenReturn(null);
source.setContext(mockJndi);
Graph graph = Graph.create(source, context);
@@ -28,7 +28,7 @@
import static org.hamcrest.core.IsNull.nullValue;
import static org.junit.Assert.assertThat;
import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.stub;
+import static org.mockito.Mockito.when;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.Hashtable;
@@ -48,7 +48,7 @@
import org.junit.Before;
import org.junit.Test;
import org.mockito.MockitoAnnotations;
-import org.mockito.MockitoAnnotations.Mock;
+import org.mockito.Mock;
/**
* @author Randall Hauch
@@ -81,8 +81,8 @@ public void beforeEach() throws Exception {
// Set up the fake JNDI context ...
source.setContext(jndiContext);
- stub(jndiContext.lookup(validCacheFactoryJndiName)).toReturn(cacheFactory);
- stub(jndiContext.lookup(validCacheJndiName)).toReturn(cache);
+ when(jndiContext.lookup(validCacheFactoryJndiName)).thenReturn(cacheFactory);
+ when(jndiContext.lookup(validCacheJndiName)).thenReturn(cache);
}
@After
@@ -28,7 +28,7 @@
import static org.hamcrest.core.IsNull.notNullValue;
import static org.hamcrest.core.IsNull.nullValue;
import static org.junit.Assert.assertThat;
-import static org.mockito.Mockito.stub;
+import static org.mockito.Mockito.when;
import java.sql.Connection;
import java.sql.DatabaseMetaData;
import java.sql.ResultSet;
@@ -55,7 +55,7 @@
import org.junit.Before;
import org.junit.Test;
import org.mockito.MockitoAnnotations;
-import org.mockito.MockitoAnnotations.Mock;
+import org.mockito.Mock;
public class JdbcMetadataRepositoryTest {
@@ -91,7 +91,7 @@ public void beforeEach() throws Exception {
longFactory = context.getValueFactories().getLongFactory();
stringFactory = context.getValueFactories().getStringFactory();
- stub(repositoryContext.getExecutionContext()).toReturn(context);
+ when(repositoryContext.getExecutionContext()).thenReturn(context);
// Set the connection properties using the environment defined in the POM files ...
this.source = TestEnvironment.configureJdbcMetadataSource("Test Repository", this);
@@ -26,7 +26,7 @@
import static org.hamcrest.core.Is.is;
import static org.hamcrest.core.IsNull.notNullValue;
import static org.junit.Assert.assertThat;
-import static org.mockito.Mockito.stub;
+import static org.mockito.Mockito.when;
import java.util.ArrayList;
import java.util.List;
import org.modeshape.graph.ExecutionContext;
@@ -37,7 +37,7 @@
import org.junit.Before;
import org.junit.Test;
import org.mockito.MockitoAnnotations;
-import org.mockito.MockitoAnnotations.Mock;
+import org.mockito.Mock;
public class JdbcMetadataSourceTest {
@@ -50,7 +50,7 @@
public void beforeEach() throws Exception {
MockitoAnnotations.initMocks(this);
- stub(repositoryContext.getExecutionContext()).toReturn(new ExecutionContext());
+ when(repositoryContext.getExecutionContext()).thenReturn(new ExecutionContext());
// Set the connection properties using the environment defined in the POM files ...
this.source = TestEnvironment.configureJdbcMetadataSource("Test Repository", this);
@@ -32,7 +32,7 @@
import org.junit.Before;
import org.junit.Test;
import org.mockito.MockitoAnnotations;
-import org.mockito.MockitoAnnotations.Mock;
+import org.mockito.Mock;
/**
* @author Randall Hauch
@@ -28,7 +28,7 @@
import static org.hamcrest.core.IsNull.notNullValue;
import static org.junit.Assert.assertThat;
import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.stub;
+import static org.mockito.Mockito.when;
import java.io.UnsupportedEncodingException;
import java.security.NoSuchAlgorithmException;
import java.util.Locale;
@@ -127,13 +127,13 @@ public void shouldCreateConnection() {
EntityManagers managers = mock(EntityManagers.class);
JpaSource source = mock(JpaSource.class);
- stub(manager.getTransaction()).toReturn(txn);
+ when(manager.getTransaction()).thenReturn(txn);
- stub(managers.checkout()).toReturn(manager);
+ when(managers.checkout()).thenReturn(manager);
- stub(source.getName()).toReturn("some name");
- stub(source.getRootUuid()).toReturn(UUID.randomUUID());
- stub(source.getEntityManagers()).toReturn(managers);
+ when(source.getName()).thenReturn("some name");
+ when(source.getRootUuid()).thenReturn(UUID.randomUUID());
+ when(source.getEntityManagers()).thenReturn(managers);
RepositoryConnection conn = model.createConnection(source);
@@ -27,7 +27,6 @@
import static org.hamcrest.core.IsNull.notNullValue;
import static org.hamcrest.core.IsNull.nullValue;
import static org.junit.Assert.assertThat;
-import static org.mockito.Matchers.isNull;
import static org.mockito.Mockito.mock;
import java.util.ArrayList;
import java.util.Enumeration;
@@ -41,6 +40,11 @@
import javax.naming.RefAddr;
import javax.naming.Reference;
import javax.naming.spi.ObjectFactory;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.mockito.MockitoAnnotations;
import org.modeshape.graph.ExecutionContext;
import org.modeshape.graph.Subgraph;
import org.modeshape.graph.cache.BasicCachePolicy;
@@ -49,11 +53,6 @@
import org.modeshape.graph.connector.RepositoryContext;
import org.modeshape.graph.connector.RepositorySourceException;
import org.modeshape.graph.observe.Observer;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Test;
-import org.mockito.MockitoAnnotations;
/**
* @author Serge Pagop
@@ -151,7 +150,7 @@ public void shouldAllowSettingName() {
public void shouldAllowSettingNameToNull() {
source.setName("something that can change the world");
source.setName(null);
- assertThat(source.getName(), is(isNull()));
+ assertThat(source.getName(), is(nullValue()));
}
@Test
@@ -257,8 +256,7 @@ private void convertToAndFromJndiReference( String sourceName,
assertThat((String)refAttributes.remove(SvnRepositorySource.RETRY_LIMIT), is(Integer.toString(source.getRetryLimit())));
assertThat((String)refAttributes.remove(SvnRepositorySource.ALLOW_CREATING_WORKSPACES),
is(Boolean.toString(source.isCreatingWorkspacesAllowed())));
- assertThat((String)refAttributes.remove(SvnRepositorySource.DEFAULT_WORKSPACE),
- is(source.getDefaultWorkspaceName()));
+ assertThat((String)refAttributes.remove(SvnRepositorySource.DEFAULT_WORKSPACE), is(source.getDefaultWorkspaceName()));
refAttributes.remove(SvnRepositorySource.PREDEFINED_WORKSPACE_NAMES);
assertThat(refAttributes.isEmpty(), is(true));
Oops, something went wrong.

0 comments on commit b0d48bc

Please sign in to comment.