Add @Override annotations to test sources

Issue: SPR-10129
This commit is contained in:
Chris Beams
2012-12-28 13:59:24 +01:00
parent 6f0c7eb8c1
commit 4c8cd7b0bd
797 changed files with 4745 additions and 0 deletions

View File

@@ -37,6 +37,7 @@ public class NestedTestBean implements INestedTestBean {
this.company = (company != null ? company : "");
}
@Override
public String getCompany() {
return company;
}

View File

@@ -137,6 +137,7 @@ public class TestBean implements BeanNameAware, BeanFactoryAware, ITestBean, IOt
this.someProperties = someProperties;
}
@Override
public void setBeanName(String beanName) {
this.beanName = beanName;
}
@@ -145,6 +146,7 @@ public class TestBean implements BeanNameAware, BeanFactoryAware, ITestBean, IOt
return beanName;
}
@Override
public void setBeanFactory(BeanFactory beanFactory) {
this.beanFactory = beanFactory;
}
@@ -161,10 +163,12 @@ public class TestBean implements BeanNameAware, BeanFactoryAware, ITestBean, IOt
return postProcessed;
}
@Override
public String getName() {
return name;
}
@Override
public void setName(String name) {
this.name = name;
}
@@ -180,10 +184,12 @@ public class TestBean implements BeanNameAware, BeanFactoryAware, ITestBean, IOt
}
}
@Override
public int getAge() {
return age;
}
@Override
public void setAge(int age) {
this.age = age;
}
@@ -196,14 +202,17 @@ public class TestBean implements BeanNameAware, BeanFactoryAware, ITestBean, IOt
this.jedi = jedi;
}
@Override
public ITestBean getSpouse() {
return (spouses != null ? spouses[0] : null);
}
@Override
public void setSpouse(ITestBean spouse) {
this.spouses = new ITestBean[] { spouse };
}
@Override
public ITestBean[] getSpouses() {
return spouses;
}
@@ -230,10 +239,12 @@ public class TestBean implements BeanNameAware, BeanFactoryAware, ITestBean, IOt
this.country = country;
}
@Override
public String[] getStringArray() {
return stringArray;
}
@Override
public void setStringArray(String[] stringArray) {
this.stringArray = stringArray;
}
@@ -302,6 +313,7 @@ public class TestBean implements BeanNameAware, BeanFactoryAware, ITestBean, IOt
this.someProperties = someProperties;
}
@Override
public INestedTestBean getDoctor() {
return doctor;
}
@@ -310,6 +322,7 @@ public class TestBean implements BeanNameAware, BeanFactoryAware, ITestBean, IOt
this.doctor = doctor;
}
@Override
public INestedTestBean getLawyer() {
return lawyer;
}
@@ -342,6 +355,7 @@ public class TestBean implements BeanNameAware, BeanFactoryAware, ITestBean, IOt
this.someBoolean = someBoolean;
}
@Override
public IndexedTestBean getNestedIndexedBean() {
return nestedIndexedBean;
}
@@ -369,12 +383,14 @@ public class TestBean implements BeanNameAware, BeanFactoryAware, ITestBean, IOt
/**
* @see ITestBean#exceptional(Throwable)
*/
@Override
public void exceptional(Throwable t) throws Throwable {
if (t != null) {
throw t;
}
}
@Override
public void unreliableFileOperation() throws IOException {
throw new IOException();
}
@@ -382,6 +398,7 @@ public class TestBean implements BeanNameAware, BeanFactoryAware, ITestBean, IOt
/**
* @see ITestBean#returnsThis()
*/
@Override
public Object returnsThis() {
return this;
}
@@ -389,9 +406,11 @@ public class TestBean implements BeanNameAware, BeanFactoryAware, ITestBean, IOt
/**
* @see IOther#absquatulate()
*/
@Override
public void absquatulate() {
}
@Override
public int haveBirthday() {
return age++;
}
@@ -419,6 +438,7 @@ public class TestBean implements BeanNameAware, BeanFactoryAware, ITestBean, IOt
return this.age;
}
@Override
public int compareTo(Object other) {
if (this.name != null && other instanceof TestBean) {
return this.name.compareTo(((TestBean) other).getName());

View File

@@ -143,6 +143,7 @@ public class MockFilterChainTests {
this.servlet = servlet;
}
@Override
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
throws IOException, ServletException {
@@ -156,9 +157,11 @@ public class MockFilterChainTests {
}
}
@Override
public void init(FilterConfig filterConfig) throws ServletException {
}
@Override
public void destroy() {
}
}

View File

@@ -54,6 +54,7 @@ public abstract class AbstractSpr3350SingleSpringContextTests extends AbstractDe
*
* @see org.springframework.test.AbstractSingleSpringContextTests#getConfigPath()
*/
@Override
protected abstract String getConfigPath();
/**

View File

@@ -44,6 +44,7 @@ public class PropertiesBasedSpr3350SingleSpringContextTests extends AbstractSpr3
*
* @see org.springframework.test.AbstractSingleSpringContextTests#createBeanDefinitionReader(org.springframework.context.support.GenericApplicationContext)
*/
@Override
protected final BeanDefinitionReader createBeanDefinitionReader(GenericApplicationContext context) {
return new PropertiesBeanDefinitionReader(context);
}
@@ -52,6 +53,7 @@ public class PropertiesBasedSpr3350SingleSpringContextTests extends AbstractSpr3
* Returns
* "PropertiesBasedSpr3350SingleSpringContextTests-context.properties".
*/
@Override
protected final String getConfigPath() {
return "PropertiesBasedSpr3350SingleSpringContextTests-context.properties";
}

View File

@@ -57,6 +57,7 @@ public class Spr3264DependencyInjectionSpringContextTests extends AbstractDepend
// Assert changes to AbstractDependencyInjectionSpringContextTests:
new AssertThrows(IllegalStateException.class) {
@Override
public void test() throws Exception {
Spr3264DependencyInjectionSpringContextTests.super.injectDependencies();
}

View File

@@ -38,6 +38,7 @@ public class XmlBasedSpr3350SingleSpringContextTests extends AbstractSpr3350Sing
/**
* Returns "XmlBasedSpr3350SingleSpringContextTests-context.xml".
*/
@Override
protected final String getConfigPath() {
return "XmlBasedSpr3350SingleSpringContextTests-context.xml";
}

View File

@@ -138,6 +138,7 @@ public class ProfileValueAnnotationAwareTransactionalTests extends TestCase {
public static class HardCodedProfileValueSource implements ProfileValueSource {
@Override
public String get(String key) {
return (key.equals(NAME) ? VALUE : null);
}

View File

@@ -447,12 +447,14 @@ public class ContextLoaderUtilsTests {
private static class FooInitializer implements ApplicationContextInitializer<GenericApplicationContext> {
@Override
public void initialize(GenericApplicationContext applicationContext) {
}
}
private static class BarInitializer implements ApplicationContextInitializer<GenericWebApplicationContext> {
@Override
public void initialize(GenericWebApplicationContext applicationContext) {
}
}

View File

@@ -369,12 +369,14 @@ public class MergedContextConfigurationTests {
private static class FooInitializer implements ApplicationContextInitializer<GenericApplicationContext> {
@Override
public void initialize(GenericApplicationContext applicationContext) {
}
}
private static class BarInitializer implements ApplicationContextInitializer<GenericApplicationContext> {
@Override
public void initialize(GenericApplicationContext applicationContext) {
}
}

View File

@@ -146,6 +146,7 @@ public class SpringRunnerContextCacheTests {
java.util.Collections.sort(testMethods, new Comparator<FrameworkMethod>() {
@Override
public int compare(FrameworkMethod method1, FrameworkMethod method2) {
return method1.getName().compareTo(method2.getName());
}

View File

@@ -109,10 +109,12 @@ public class ConcreteTransactionalJUnit38SpringContextTests extends AbstractTran
return simpleJdbcTemplate.update("DELETE FROM person WHERE name=?", name);
}
@Override
public final void afterPropertiesSet() throws Exception {
this.beanInitialized = true;
}
@Override
public final void setBeanName(final String beanName) {
this.beanName = beanName;
}

View File

@@ -187,6 +187,7 @@ public class ProfileValueJUnit38SpringContextTests extends TestCase {
public static class HardCodedProfileValueSource implements ProfileValueSource {
@Override
public String get(final String key) {
return (key.equals(NAME) ? VALUE : null);
}

View File

@@ -42,22 +42,27 @@ public class ClassLevelDisabledSpringRunnerTests {
public static class CustomTestExecutionListener implements TestExecutionListener {
@Override
public void beforeTestClass(TestContext testContext) throws Exception {
fail("A listener method for a disabled test should never be executed!");
}
@Override
public void prepareTestInstance(TestContext testContext) throws Exception {
fail("A listener method for a disabled test should never be executed!");
}
@Override
public void beforeTestMethod(TestContext testContext) throws Exception {
fail("A listener method for a disabled test should never be executed!");
}
@Override
public void afterTestMethod(TestContext testContext) throws Exception {
fail("A listener method for a disabled test should never be executed!");
}
@Override
public void afterTestClass(TestContext testContext) throws Exception {
fail("A listener method for a disabled test should never be executed!");
}

View File

@@ -104,6 +104,7 @@ public class ConcreteTransactionalJUnit4SpringContextTests extends AbstractTrans
return simpleJdbcTemplate.update("DELETE FROM person WHERE name=?", name);
}
@Override
@Resource
public void setDataSource(DataSource dataSource) {
super.setDataSource(dataSource);
@@ -119,10 +120,12 @@ public class ConcreteTransactionalJUnit4SpringContextTests extends AbstractTrans
this.bar = bar;
}
@Override
public final void setBeanName(final String beanName) {
this.beanName = beanName;
}
@Override
public final void afterPropertiesSet() throws Exception {
this.beanInitialized = true;
}

View File

@@ -48,6 +48,7 @@ public class HardCodedProfileValueSourceSpringRunnerTests extends EnabledAndIgno
public static class HardCodedProfileValueSource implements ProfileValueSource {
@Override
public String get(final String key) {
return (key.equals(NAME) ? VALUE : null);
}

View File

@@ -53,6 +53,7 @@ public class RollbackOverrideDefaultRollbackTrueTransactionalSpringRunnerTests e
countRowsInPersonTable(simpleJdbcTemplate));
}
@Override
@Before
public void verifyInitialTestData() {
clearPersonTable(simpleJdbcTemplate);
@@ -61,6 +62,7 @@ public class RollbackOverrideDefaultRollbackTrueTransactionalSpringRunnerTests e
countRowsInPersonTable(simpleJdbcTemplate));
}
@Override
@Test
@Transactional
@Rollback(false)

View File

@@ -136,14 +136,17 @@ public class SpringJUnit4ClassRunnerAppCtxTests implements ApplicationContextAwa
// ------------------------------------------------------------------------|
@Override
public final void afterPropertiesSet() throws Exception {
this.beanInitialized = true;
}
@Override
public final void setApplicationContext(final ApplicationContext applicationContext) throws BeansException {
this.applicationContext = applicationContext;
}
@Override
public final void setBeanName(final String beanName) {
this.beanName = beanName;
}

View File

@@ -25,6 +25,7 @@ import org.springframework.context.support.GenericApplicationContext;
*/
public class DevProfileInitializer implements ApplicationContextInitializer<GenericApplicationContext> {
@Override
public void initialize(GenericApplicationContext applicationContext) {
applicationContext.getEnvironment().setActiveProfiles("dev");
}

View File

@@ -25,6 +25,7 @@ import org.springframework.context.support.GenericApplicationContext;
*/
public class FooBarAliasInitializer implements ApplicationContextInitializer<GenericApplicationContext> {
@Override
public void initialize(GenericApplicationContext applicationContext) {
applicationContext.registerAlias("foo", "bar");
}

View File

@@ -53,6 +53,7 @@ public class InitializerWithoutConfigFilesOrClassesTest {
static class EntireAppInitializer implements ApplicationContextInitializer<GenericApplicationContext> {
@Override
public void initialize(GenericApplicationContext applicationContext) {
new AnnotatedBeanDefinitionReader(applicationContext).register(GlobalConfig.class);
}

View File

@@ -34,6 +34,7 @@ import org.springframework.test.context.junit4.aci.DevProfileInitializer;
@ContextConfiguration(initializers = DevProfileInitializer.class)
public class MergedInitializersAnnotationConfigTests extends SingleInitializerAnnotationConfigTests {
@Override
@Test
public void activeBeans() {
assertEquals("foo", foo);

View File

@@ -125,10 +125,12 @@ public class OrderedInitializersAnnotationConfigTests {
static class OrderedOneInitializer implements ApplicationContextInitializer<GenericApplicationContext>, Ordered {
@Override
public void initialize(GenericApplicationContext applicationContext) {
applicationContext.getEnvironment().setActiveProfiles(PROFILE_ONE);
}
@Override
public int getOrder() {
return 1;
}
@@ -137,6 +139,7 @@ public class OrderedInitializersAnnotationConfigTests {
@Order(2)
static class OrderedTwoInitializer implements ApplicationContextInitializer<GenericApplicationContext> {
@Override
public void initialize(GenericApplicationContext applicationContext) {
applicationContext.getEnvironment().setActiveProfiles(PROFILE_TWO);
}

View File

@@ -39,11 +39,13 @@ public class HibernatePersonRepository implements PersonRepository {
this.sessionFactory = sessionFactory;
}
@Override
public Person save(Person person) {
this.sessionFactory.getCurrentSession().save(person);
return person;
}
@Override
public Person findByName(String name) {
return (Person) this.sessionFactory.getCurrentSession().createQuery(
"from Person person where person.name = :name").setString("name", name).uniqueResult();

View File

@@ -41,10 +41,12 @@ public class StandardPersonService implements PersonService {
this.personRepository = personRepository;
}
@Override
public Person findByName(String name) {
return this.personRepository.findByName(name);
}
@Override
@Transactional(readOnly = false)
public Person save(Person person) {
return this.personRepository.save(person);

View File

@@ -50,6 +50,7 @@ public class LookUpTxMgrViaTransactionManagementConfigurerTests {
@Configuration
static class Config implements TransactionManagementConfigurer {
@Override
public PlatformTransactionManager annotationDrivenTransactionManager() {
return txManager1();
}

View File

@@ -90,10 +90,12 @@ public class ConcreteTransactionalTestNGSpringContextTests extends AbstractTrans
return simpleJdbcTemplate.update("DELETE FROM person WHERE name=?", name);
}
@Override
public void afterPropertiesSet() throws Exception {
this.beanInitialized = true;
}
@Override
public void setBeanName(String beanName) {
this.beanName = beanName;
}

View File

@@ -123,27 +123,34 @@ public class FailingBeforeAndAfterMethodsTests {
int failedConfigurationsCount = 0;
@Override
public void onFinish(ITestContext testContext) {
this.failedConfigurationsCount += testContext.getFailedConfigurations().size();
}
@Override
public void onStart(ITestContext testContext) {
}
@Override
public void onTestFailedButWithinSuccessPercentage(ITestResult testResult) {
}
@Override
public void onTestFailure(ITestResult testResult) {
this.testFailureCount++;
}
@Override
public void onTestSkipped(ITestResult testResult) {
}
@Override
public void onTestStart(ITestResult testResult) {
this.testStartCount++;
}
@Override
public void onTestSuccess(ITestResult testResult) {
this.testSuccessCount++;
}

View File

@@ -66,6 +66,7 @@ public abstract class AbstractBasicWacTests implements ServletContextAware {
protected String foo;
@Override
public void setServletContext(ServletContext servletContext) {
this.servletContext = servletContext;
}

View File

@@ -34,21 +34,25 @@ public class CallCountingTransactionManager extends AbstractPlatformTransactionM
public int inflight;
@Override
protected Object doGetTransaction() {
return new Object();
}
@Override
protected void doBegin(Object transaction, TransactionDefinition definition) {
this.lastDefinition = definition;
++begun;
++inflight;
}
@Override
protected void doCommit(DefaultTransactionStatus status) {
++commits;
--inflight;
}
@Override
protected void doRollback(DefaultTransactionStatus status) {
++rollbacks;
--inflight;

View File

@@ -86,6 +86,7 @@ public class ReflectionTestUtilsTests {
new AssertThrows(IllegalArgumentException.class,
"Calling setField() with NULL for a primitive type should throw an IllegalArgumentException.") {
@Override
public void test() throws Exception {
setField(person, "id", null, long.class);
}
@@ -94,6 +95,7 @@ public class ReflectionTestUtilsTests {
new AssertThrows(IllegalArgumentException.class,
"Calling setField() with NULL for a primitive type should throw an IllegalArgumentException.") {
@Override
public void test() throws Exception {
setField(person, "age", null, int.class);
}
@@ -102,6 +104,7 @@ public class ReflectionTestUtilsTests {
new AssertThrows(IllegalArgumentException.class,
"Calling setField() with NULL for a primitive type should throw an IllegalArgumentException.") {
@Override
public void test() throws Exception {
setField(person, "likesPets", null, boolean.class);
}
@@ -187,6 +190,7 @@ public class ReflectionTestUtilsTests {
new AssertThrows(IllegalArgumentException.class,
"Calling invokeSetterMethod() with NULL for a primitive type should throw an IllegalArgumentException.") {
@Override
public void test() throws Exception {
invokeSetterMethod(person, "id", null, long.class);
}
@@ -195,6 +199,7 @@ public class ReflectionTestUtilsTests {
new AssertThrows(IllegalArgumentException.class,
"Calling invokeSetterMethod() with NULL for a primitive type should throw an IllegalArgumentException.") {
@Override
public void test() throws Exception {
invokeSetterMethod(person, "age", null, int.class);
}
@@ -203,6 +208,7 @@ public class ReflectionTestUtilsTests {
new AssertThrows(IllegalArgumentException.class,
"Calling invokeSetterMethod() with NULL for a primitive type should throw an IllegalArgumentException.") {
@Override
public void test() throws Exception {
invokeSetterMethod(person, "likesPets", null, boolean.class);
}