Skip to content

Commit

Permalink
Replace EasyMock with Mockito
Browse files Browse the repository at this point in the history
Issue: SPR-10126
  • Loading branch information
philwebb committed Mar 6, 2013
1 parent a399b13 commit 05765d7
Show file tree
Hide file tree
Showing 180 changed files with 2,349 additions and 4,292 deletions.
8 changes: 0 additions & 8 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ configure(allprojects) { project ->
version = qualifyVersionIfNecessary(version)

ext.aspectjVersion = "1.7.2"
ext.easymockVersion = "2.5.2"
ext.hsqldbVersion = "1.8.0.10"
ext.junitVersion = "4.11"
ext.slf4jVersion = "1.6.1"
Expand Down Expand Up @@ -69,13 +68,6 @@ configure(allprojects) { project ->
testCompile("junit:junit:${junitVersion}")
testCompile("org.hamcrest:hamcrest-all:1.3")
testCompile("org.mockito:mockito-core:1.9.5")
if (project.name in ["spring",
"spring-orm-hibernate4", "spring-oxm", "spring-struts",
"spring-test", "spring-test-mvc", "spring-tx", "spring-web",
"spring-webmvc", "spring-webmvc-portlet", "spring-webmvc-tiles3"]) {
testCompile("org.easymock:easymock:${easymockVersion}")
testCompile "org.easymock:easymockclassextension:${easymockVersion}"
}
}

ext.javadocLinks = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,6 @@

package org.springframework.aop.framework.adapter;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.fail;
import static org.mockito.BDDMockito.given;
import static org.mockito.Mockito.mock;

import java.io.FileNotFoundException;
import java.io.IOException;
import java.lang.reflect.Method;
Expand All @@ -33,6 +28,9 @@
import org.springframework.aop.ThrowsAdvice;
import org.springframework.tests.aop.advice.MethodCounter;

import static org.junit.Assert.*;
import static org.mockito.BDDMockito.*;


/**
* @author Rod Johnson
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,13 @@

package org.springframework.aop.interceptor;

import static org.junit.Assert.*;
import static org.mockito.BDDMockito.given;
import static org.mockito.Matchers.anyString;
import static org.mockito.Matchers.eq;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;

import org.aopalliance.intercept.MethodInvocation;
import org.apache.commons.logging.Log;
import org.junit.Test;

import static org.junit.Assert.*;
import static org.mockito.BDDMockito.*;

/**
* @author Rob Harrop
* @author Rick Evans
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2002-2012 the original author or authors.
* Copyright 2002-2013 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -16,18 +16,13 @@

package org.springframework.aop.interceptor;

import static org.junit.Assert.*;
import static org.mockito.BDDMockito.given;
import static org.mockito.Matchers.anyString;
import static org.mockito.Matchers.eq;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;

import org.aopalliance.intercept.MethodInvocation;
import org.apache.commons.logging.Log;
import org.junit.Test;

import static org.junit.Assert.*;
import static org.mockito.BDDMockito.*;

/**
* Unit tests for the {@link DebugInterceptor} class.
*
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2002-2012 the original author or authors.
* Copyright 2002-2013 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -16,16 +16,13 @@

package org.springframework.aop.interceptor;

import static org.junit.Assert.*;
import static org.mockito.BDDMockito.given;
import static org.mockito.Matchers.anyString;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;

import org.aopalliance.intercept.MethodInvocation;
import org.apache.commons.logging.Log;
import org.junit.Test;

import static org.junit.Assert.*;
import static org.mockito.BDDMockito.*;

/**
* @author Rob Harrop
* @author Rick Evans
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,13 @@

package org.springframework.aop.interceptor;

import static org.junit.Assert.fail;
import static org.mockito.BDDMockito.given;
import static org.mockito.Matchers.anyString;
import static org.mockito.Matchers.eq;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;

import org.aopalliance.intercept.MethodInvocation;
import org.apache.commons.logging.Log;
import org.junit.Test;

import static org.junit.Assert.*;
import static org.mockito.BDDMockito.*;

/**
* Unit tests for the {@link SimpleTraceInterceptor} class.
*
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2002-2012 the original author or authors.
* Copyright 2002-2013 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -16,11 +16,11 @@

package org.springframework.aop.scope;

import static org.mockito.Mockito.mock;

import org.junit.Test;
import org.springframework.beans.factory.config.ConfigurableBeanFactory;

import static org.mockito.BDDMockito.*;

/**
* Unit tests for the {@link DefaultScopedObject} class.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,6 @@

package org.springframework.aop.support;

import static org.hamcrest.Matchers.instanceOf;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertSame;
import static org.junit.Assert.assertThat;
import static org.junit.Assert.assertTrue;
import static org.mockito.BDDMockito.given;
import static org.mockito.Mockito.mock;

import java.io.Serializable;

import org.aopalliance.intercept.MethodInterceptor;
Expand All @@ -41,6 +33,10 @@
import org.springframework.tests.sample.beans.TestBean;
import org.springframework.util.SerializationTestUtils;

import static org.hamcrest.Matchers.*;
import static org.junit.Assert.*;
import static org.mockito.BDDMockito.*;

/**
* @author Rod Johnson
* @author Chris Beams
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,24 +16,6 @@

package org.springframework.beans.factory;

import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.Matchers.containsString;
import static org.hamcrest.Matchers.equalTo;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNotSame;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertSame;
import static org.junit.Assert.assertThat;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import static org.mockito.BDDMockito.given;
import static org.mockito.Matchers.isNull;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.never;
import static org.mockito.Mockito.verify;

import java.io.Closeable;
import java.lang.reflect.Field;
import java.net.MalformedURLException;
Expand Down Expand Up @@ -104,6 +86,10 @@
import org.springframework.util.StopWatch;
import org.springframework.util.StringValueResolver;

import static org.hamcrest.Matchers.*;
import static org.junit.Assert.*;
import static org.mockito.BDDMockito.*;

/**
* Tests properties population and autowire behavior.
*
Expand Down Expand Up @@ -2261,8 +2247,8 @@ public void testContainsBeanReturnsTrueEvenForAbstractBeanDefinition() {
DefaultListableBeanFactory bf = new DefaultListableBeanFactory();
bf.registerBeanDefinition("abs", BeanDefinitionBuilder
.rootBeanDefinition(TestBean.class).setAbstract(true).getBeanDefinition());
assertThat(bf.containsBean("abs"), is(true));
assertThat(bf.containsBean("bogus"), is(false));
assertThat(bf.containsBean("abs"), equalTo(true));
assertThat(bf.containsBean("bogus"), equalTo(false));
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,16 @@

package org.springframework.beans.factory.config;

import static org.junit.Assert.assertTrue;
import static org.mockito.Mockito.mock;

import java.util.HashMap;
import java.util.Map;

import org.junit.Before;
import org.junit.Test;
import org.springframework.beans.factory.support.DefaultListableBeanFactory;

import static org.junit.Assert.*;
import static org.mockito.BDDMockito.*;

/**
* Unit tests for {@link CustomScopeConfigurer}.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,6 @@

package org.springframework.beans.factory.config;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertSame;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import static org.mockito.BDDMockito.given;
import static org.mockito.Mockito.mock;
import static org.springframework.tests.TestResourceUtils.qualifiedResource;

import java.util.Date;

import javax.inject.Provider;
Expand All @@ -38,6 +30,10 @@
import org.springframework.core.io.Resource;
import org.springframework.util.SerializationTestUtils;

import static org.junit.Assert.*;
import static org.mockito.BDDMockito.*;
import static org.springframework.tests.TestResourceUtils.*;

/**
* @author Colin Sampaleanu
* @author Juergen Hoeller
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2002-2012 the original author or authors.
* Copyright 2002-2013 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -16,10 +16,6 @@

package org.springframework.beans.factory.config;

import static org.junit.Assert.*;
import static org.mockito.Mockito.mock;
import static org.springframework.beans.factory.support.BeanDefinitionBuilder.genericBeanDefinition;

import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;
Expand All @@ -30,6 +26,10 @@
import org.springframework.core.NestedCheckedException;
import org.springframework.core.NestedRuntimeException;

import static org.junit.Assert.*;
import static org.mockito.BDDMockito.*;
import static org.springframework.beans.factory.support.BeanDefinitionBuilder.*;

/**
* Unit tests for {@link ServiceLocatorFactoryBean}.
*
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2002-2012 the original author or authors.
* Copyright 2002-2013 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -16,15 +16,13 @@

package org.springframework.beans.factory.parsing;

import static org.mockito.Matchers.any;
import static org.mockito.Matchers.isA;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;

import org.apache.commons.logging.Log;
import org.junit.Test;
import org.springframework.core.io.DescriptiveResource;

import static org.mockito.Matchers.*;
import static org.mockito.BDDMockito.*;

/**
* @author Rick Evans
* @author Juergen Hoeller
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,15 @@

package org.springframework.beans.factory.wiring;

import static org.mockito.BDDMockito.given;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
import junit.framework.TestCase;

import org.springframework.beans.factory.BeanFactory;
import org.springframework.beans.factory.support.BeanDefinitionBuilder;
import org.springframework.beans.factory.support.DefaultListableBeanFactory;
import org.springframework.tests.sample.beans.TestBean;

import static org.mockito.BDDMockito.*;


/**
* @author Rick Evans
Expand Down
Loading

0 comments on commit 05765d7

Please sign in to comment.