diff --git a/spring-aspects/src/main/java/org/springframework/transaction/aspectj/AbstractTransactionAspect.aj b/spring-aspects/src/main/java/org/springframework/transaction/aspectj/AbstractTransactionAspect.aj index 3ce264d9e1..54bd4ef746 100644 --- a/spring-aspects/src/main/java/org/springframework/transaction/aspectj/AbstractTransactionAspect.aj +++ b/spring-aspects/src/main/java/org/springframework/transaction/aspectj/AbstractTransactionAspect.aj @@ -60,7 +60,7 @@ public abstract aspect AbstractTransactionAspect extends TransactionAspectSuppor before(Object txObject) : transactionalMethodExecution(txObject) { MethodSignature methodSignature = (MethodSignature) thisJoinPoint.getSignature(); Method method = methodSignature.getMethod(); - TransactionInfo txInfo = createTransactionIfNecessary(method, txObject.getClass()); + createTransactionIfNecessary(method, txObject.getClass()); } @SuppressAjWarnings("adviceDidNotMatch") diff --git a/spring-aspects/src/test/java/org/springframework/beans/factory/aspectj/AbstractBeanConfigurerTests.java b/spring-aspects/src/test/java/org/springframework/beans/factory/aspectj/AbstractBeanConfigurerTests.java index 054c99f3e3..71a10afcaf 100644 --- a/spring-aspects/src/test/java/org/springframework/beans/factory/aspectj/AbstractBeanConfigurerTests.java +++ b/spring-aspects/src/test/java/org/springframework/beans/factory/aspectj/AbstractBeanConfigurerTests.java @@ -211,6 +211,7 @@ public abstract class AbstractBeanConfigurerTests extends TestCase { MailClientDependencyInjectionAspect.aspectOf().setMailSender(new JavaMailSenderImpl()); Order testOrder = new Order(); Order deserializedOrder = serializeAndDeserialize(testOrder); + assertNotNull(deserializedOrder); assertNotNull("Interface driven injection didn't occur for deserialization", testOrder.mailSender); } diff --git a/spring-beans/src/test/java/org/springframework/beans/factory/config/CustomScopeConfigurerTests.java b/spring-beans/src/test/java/org/springframework/beans/factory/config/CustomScopeConfigurerTests.java index 65e6debd15..f06388cc8d 100644 --- a/spring-beans/src/test/java/org/springframework/beans/factory/config/CustomScopeConfigurerTests.java +++ b/spring-beans/src/test/java/org/springframework/beans/factory/config/CustomScopeConfigurerTests.java @@ -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. @@ -45,7 +45,6 @@ public final class CustomScopeConfigurerTests { @Test public void testWithNoScopes() throws Exception { - Scope scope = mock(Scope.class); CustomScopeConfigurer figurer = new CustomScopeConfigurer(); figurer.postProcessBeanFactory(factory); } diff --git a/spring-beans/src/test/java/org/springframework/beans/factory/config/PropertyResourceConfigurerTests.java b/spring-beans/src/test/java/org/springframework/beans/factory/config/PropertyResourceConfigurerTests.java index 1212913cb1..fab64afdcb 100644 --- a/spring-beans/src/test/java/org/springframework/beans/factory/config/PropertyResourceConfigurerTests.java +++ b/spring-beans/src/test/java/org/springframework/beans/factory/config/PropertyResourceConfigurerTests.java @@ -17,6 +17,7 @@ package org.springframework.beans.factory.config; import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNull; import static org.junit.Assert.assertSame; import static org.junit.Assert.assertTrue; @@ -644,6 +645,7 @@ public final class PropertyResourceConfigurerTests { ppc.postProcessBeanFactory(factory); TestBean tb = (TestBean) factory.getBean("tb"); + assertNotNull(tb); assertEquals(0, factory.getAliases("tb").length); } diff --git a/spring-beans/src/test/java/org/springframework/beans/factory/support/security/CallbacksSecurityTests.java b/spring-beans/src/test/java/org/springframework/beans/factory/support/security/CallbacksSecurityTests.java index 249c5bac02..c8c6595e45 100644 --- a/spring-beans/src/test/java/org/springframework/beans/factory/support/security/CallbacksSecurityTests.java +++ b/spring-beans/src/test/java/org/springframework/beans/factory/support/security/CallbacksSecurityTests.java @@ -515,8 +515,7 @@ public class CallbacksSecurityTests { perms.add(new AuthPermission("getSubject")); ProtectionDomain pd = new ProtectionDomain(null, perms); - AccessControlContext acc = new AccessControlContext( - new ProtectionDomain[] { pd }); + new AccessControlContext(new ProtectionDomain[] { pd }); final Subject subject = new Subject(); subject.getPrincipals().add(new TestPrincipal("user1")); diff --git a/spring-beans/src/test/java/org/springframework/beans/factory/xml/AbstractBeanFactoryTests.java b/spring-beans/src/test/java/org/springframework/beans/factory/xml/AbstractBeanFactoryTests.java index 4510487801..3d88251b7e 100644 --- a/spring-beans/src/test/java/org/springframework/beans/factory/xml/AbstractBeanFactoryTests.java +++ b/spring-beans/src/test/java/org/springframework/beans/factory/xml/AbstractBeanFactoryTests.java @@ -121,7 +121,7 @@ public abstract class AbstractBeanFactoryTests extends TestCase { public void testGetInstanceByNonmatchingClass() { try { - Object o = getBeanFactory().getBean("rod", BeanFactory.class); + getBeanFactory().getBean("rod", BeanFactory.class); fail("Rod bean is not of type BeanFactory; getBeanInstance(rod, BeanFactory.class) should throw BeanNotOfRequiredTypeException"); } catch (BeanNotOfRequiredTypeException ex) { @@ -155,7 +155,7 @@ public abstract class AbstractBeanFactoryTests extends TestCase { public void testGetSharedInstanceByNonmatchingClass() { try { - Object o = getBeanFactory().getBean("rod", BeanFactory.class); + getBeanFactory().getBean("rod", BeanFactory.class); fail("Rod bean is not of type BeanFactory; getBeanInstance(rod, BeanFactory.class) should throw BeanNotOfRequiredTypeException"); } catch (BeanNotOfRequiredTypeException ex) { @@ -199,7 +199,7 @@ public abstract class AbstractBeanFactoryTests extends TestCase { public void testNotThere() { assertFalse(getBeanFactory().containsBean("Mr Squiggle")); try { - Object o = getBeanFactory().getBean("Mr Squiggle"); + getBeanFactory().getBean("Mr Squiggle"); fail("Can't find missing bean"); } catch (BeansException ex) { @@ -223,7 +223,7 @@ public abstract class AbstractBeanFactoryTests extends TestCase { public void xtestTypeMismatch() { try { - Object o = getBeanFactory().getBean("typeMismatch"); + getBeanFactory().getBean("typeMismatch"); fail("Shouldn't succeed with type mismatch"); } catch (BeanCreationException wex) { @@ -278,6 +278,7 @@ public abstract class AbstractBeanFactoryTests extends TestCase { */ public void testFactoryIsInitialized() throws Exception { TestBean tb = (TestBean) getBeanFactory().getBean("singletonFactory"); + assertNotNull(tb); DummyFactory factory = (DummyFactory) getBeanFactory().getBean("&singletonFactory"); assertTrue("Factory was initialized because it implemented InitializingBean", factory.wasInitialized()); } diff --git a/spring-context/src/test/java/org/springframework/jmx/export/assembler/AbstractJmxAssemblerTests.java b/spring-context/src/test/java/org/springframework/jmx/export/assembler/AbstractJmxAssemblerTests.java index 59b71a58b2..2c4a06e0be 100644 --- a/spring-context/src/test/java/org/springframework/jmx/export/assembler/AbstractJmxAssemblerTests.java +++ b/spring-context/src/test/java/org/springframework/jmx/export/assembler/AbstractJmxAssemblerTests.java @@ -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. You may obtain a copy of @@ -51,6 +51,7 @@ public abstract class AbstractJmxAssemblerTests extends AbstractJmxTests { public void testRegisterOperations() throws Exception { IJmxTestBean bean = getBean(); + assertNotNull(bean); MBeanInfo inf = getMBeanInfo(); assertEquals("Incorrect number of operations registered", getExpectedOperationCount(), inf.getOperations().length); @@ -58,6 +59,7 @@ public abstract class AbstractJmxAssemblerTests extends AbstractJmxTests { public void testRegisterAttributes() throws Exception { IJmxTestBean bean = getBean(); + assertNotNull(bean); MBeanInfo inf = getMBeanInfo(); assertEquals("Incorrect number of attributes registered", getExpectedAttributeCount(), inf.getAttributes().length); diff --git a/spring-context/src/test/java/org/springframework/jmx/export/assembler/InterfaceBasedMBeanInfoAssemblerMappedTests.java b/spring-context/src/test/java/org/springframework/jmx/export/assembler/InterfaceBasedMBeanInfoAssemblerMappedTests.java index dc9db0fc5e..5cd8488eb7 100644 --- a/spring-context/src/test/java/org/springframework/jmx/export/assembler/InterfaceBasedMBeanInfoAssemblerMappedTests.java +++ b/spring-context/src/test/java/org/springframework/jmx/export/assembler/InterfaceBasedMBeanInfoAssemblerMappedTests.java @@ -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. @@ -39,7 +39,7 @@ public class InterfaceBasedMBeanInfoAssemblerMappedTests extends AbstractJmxAsse public void testWithUnknownClass() throws Exception { try { - InterfaceBasedMBeanInfoAssembler assembler = getWithMapping("com.foo.bar.Unknown"); + getWithMapping("com.foo.bar.Unknown"); fail("Should have thrown IllegalArgumentException"); } catch (IllegalArgumentException ex) { @@ -49,7 +49,7 @@ public class InterfaceBasedMBeanInfoAssemblerMappedTests extends AbstractJmxAsse public void testWithNonInterface() throws Exception { try { - InterfaceBasedMBeanInfoAssembler assembler = getWithMapping("JmxTestBean"); + getWithMapping("JmxTestBean"); fail("Should have thrown IllegalArgumentException"); } catch (IllegalArgumentException ex) { diff --git a/spring-core/src/test/java/org/springframework/core/enums/LabeledEnumTests.java b/spring-core/src/test/java/org/springframework/core/enums/LabeledEnumTests.java index 4bd9a3f182..de0fccf46b 100644 --- a/spring-core/src/test/java/org/springframework/core/enums/LabeledEnumTests.java +++ b/spring-core/src/test/java/org/springframework/core/enums/LabeledEnumTests.java @@ -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. @@ -104,7 +104,7 @@ public class LabeledEnumTests extends TestCase { public void testDoesNotMatchWrongClass() { try { - LabeledEnum none = StaticLabeledEnumResolver.instance().getLabeledEnumByCode(Dog.class, + StaticLabeledEnumResolver.instance().getLabeledEnumByCode(Dog.class, new Short((short) 1)); fail("Should have failed"); } @@ -119,10 +119,11 @@ public class LabeledEnumTests extends TestCase { } - @SuppressWarnings("serial") + @SuppressWarnings({ "serial", "unused" }) private static class Other extends StaticLabeledEnum { public static final Other THING1 = new Other(1, "Thing1"); + public static final Other THING2 = new Other(2, "Thing2"); diff --git a/spring-core/src/test/java/org/springframework/util/StopWatchTests.java b/spring-core/src/test/java/org/springframework/util/StopWatchTests.java index e7d745d416..4170f55624 100644 --- a/spring-core/src/test/java/org/springframework/util/StopWatchTests.java +++ b/spring-core/src/test/java/org/springframework/util/StopWatchTests.java @@ -1,6 +1,6 @@ /* - * 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. @@ -34,7 +34,6 @@ public class StopWatchTests extends TestCase { String name1 = "Task 1"; String name2 = "Task 2"; - long fudgeFactor = 5L; assertFalse(sw.isRunning()); sw.start(name1); Thread.sleep(int1); @@ -44,6 +43,7 @@ public class StopWatchTests extends TestCase { // TODO are timings off in JUnit? Why do these assertions sometimes fail // under both Ant and Eclipse? + //long fudgeFactor = 5L; //assertTrue("Unexpected timing " + sw.getTotalTime(), sw.getTotalTime() >= int1); //assertTrue("Unexpected timing " + sw.getTotalTime(), sw.getTotalTime() <= int1 + fudgeFactor); sw.start(name2); @@ -72,7 +72,6 @@ public class StopWatchTests extends TestCase { String name1 = "Task 1"; String name2 = "Task 2"; - long fudgeFactor = 5L; assertFalse(sw.isRunning()); sw.start(name1); Thread.sleep(int1); @@ -82,6 +81,7 @@ public class StopWatchTests extends TestCase { // TODO are timings off in JUnit? Why do these assertions sometimes fail // under both Ant and Eclipse? + //long fudgeFactor = 5L; //assertTrue("Unexpected timing " + sw.getTotalTime(), sw.getTotalTime() >= int1); //assertTrue("Unexpected timing " + sw.getTotalTime(), sw.getTotalTime() <= int1 + fudgeFactor); sw.start(name2); diff --git a/spring-expression/src/test/java/org/springframework/expression/spel/MapAccessTests.java b/spring-expression/src/test/java/org/springframework/expression/spel/MapAccessTests.java index 3ea0f98e3d..6118c82af9 100644 --- a/spring-expression/src/test/java/org/springframework/expression/spel/MapAccessTests.java +++ b/spring-expression/src/test/java/org/springframework/expression/spel/MapAccessTests.java @@ -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. @@ -17,6 +17,7 @@ package org.springframework.expression.spel; import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; import java.util.HashMap; import java.util.Map; @@ -83,9 +84,10 @@ public class MapAccessTests extends ExpressionTestCase { ExpressionParser parser = new SpelExpressionParser(); Expression exp = parser.parseExpression("testBean.properties['key2']"); - String key= (String)exp.getValue(bean); + String key = (String) exp.getValue(bean); + assertNotNull(key); - } + } public static class TestBean { diff --git a/spring-expression/src/test/java/org/springframework/expression/spel/SpelDocumentationTests.java b/spring-expression/src/test/java/org/springframework/expression/spel/SpelDocumentationTests.java index 9416ba87cf..41261a4d7c 100644 --- a/spring-expression/src/test/java/org/springframework/expression/spel/SpelDocumentationTests.java +++ b/spring-expression/src/test/java/org/springframework/expression/spel/SpelDocumentationTests.java @@ -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. @@ -18,6 +18,7 @@ package org.springframework.expression.spel; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNull; import static org.junit.Assert.assertTrue; @@ -213,9 +214,11 @@ public class SpelDocumentationTests extends ExpressionTestCase { societyContext.setRootObject(new IEEE()); // Officer's Dictionary Inventor pupin = parser.parseExpression("officers['president']").getValue(societyContext, Inventor.class); + assertNotNull(pupin); // evaluates to "Idvor" String city = parser.parseExpression("officers['president'].PlaceOfBirth.city").getValue(societyContext, String.class); + assertNotNull(city); // setting values Inventor i = parser.parseExpression("officers['advisors'][0]").getValue(societyContext,Inventor.class); diff --git a/spring-expression/src/test/java/org/springframework/expression/spel/SpelReproTests.java b/spring-expression/src/test/java/org/springframework/expression/spel/SpelReproTests.java index 765422302a..fdf04c7ba8 100644 --- a/spring-expression/src/test/java/org/springframework/expression/spel/SpelReproTests.java +++ b/spring-expression/src/test/java/org/springframework/expression/spel/SpelReproTests.java @@ -19,6 +19,7 @@ package org.springframework.expression.spel; import static org.hamcrest.Matchers.is; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertThat; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; @@ -1680,6 +1681,7 @@ public class SpelReproTests extends ExpressionTestCase { ExpressionParser parser = new SpelExpressionParser(); StandardEvaluationContext evaluationContext = new StandardEvaluationContext(new BooleanHolder()); Class valueType = parser.parseExpression("simpleProperty").getValueType(evaluationContext); + assertNotNull(valueType); } @Test @@ -1687,6 +1689,7 @@ public class SpelReproTests extends ExpressionTestCase { ExpressionParser parser = new SpelExpressionParser(); StandardEvaluationContext evaluationContext = new StandardEvaluationContext(new BooleanHolder()); Object value = parser.parseExpression("simpleProperty").getValue(evaluationContext); + assertNotNull(value); } @Test @@ -1694,6 +1697,7 @@ public class SpelReproTests extends ExpressionTestCase { ExpressionParser parser = new SpelExpressionParser(); StandardEvaluationContext evaluationContext = new StandardEvaluationContext(new BooleanHolder()); Class valueType = parser.parseExpression("primitiveProperty").getValueType(evaluationContext); + assertNotNull(valueType); } @Test @@ -1701,6 +1705,7 @@ public class SpelReproTests extends ExpressionTestCase { ExpressionParser parser = new SpelExpressionParser(); StandardEvaluationContext evaluationContext = new StandardEvaluationContext(new BooleanHolder()); Object value = parser.parseExpression("primitiveProperty").getValue(evaluationContext); + assertNotNull(value); } @Test diff --git a/spring-jdbc/src/test/java/org/springframework/jdbc/support/SQLStateExceptionTranslatorTests.java b/spring-jdbc/src/test/java/org/springframework/jdbc/support/SQLStateExceptionTranslatorTests.java index 3578c1e93b..0aad57f96d 100644 --- a/spring-jdbc/src/test/java/org/springframework/jdbc/support/SQLStateExceptionTranslatorTests.java +++ b/spring-jdbc/src/test/java/org/springframework/jdbc/support/SQLStateExceptionTranslatorTests.java @@ -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. @@ -67,7 +67,6 @@ public class SQLStateExceptionTranslatorTests extends TestCase { * Bug 729170 */ public void testMalformedSqlStateCodes() { - String sql = "SELECT FOO FROM BAR"; SQLException sex = new SQLException("Message", null, 1); testMalformedSqlStateCode(sex); diff --git a/spring-jms/src/test/java/org/springframework/jms/core/JmsTemplate102Tests.java b/spring-jms/src/test/java/org/springframework/jms/core/JmsTemplate102Tests.java index abcb7a7e66..12f01be2b5 100644 --- a/spring-jms/src/test/java/org/springframework/jms/core/JmsTemplate102Tests.java +++ b/spring-jms/src/test/java/org/springframework/jms/core/JmsTemplate102Tests.java @@ -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. @@ -207,7 +207,7 @@ public class JmsTemplate102Tests extends TestCase { template.execute(new SessionCallback() { @Override public Object doInJms(Session session) throws JMSException { - boolean b = session.getTransacted(); + session.getTransacted(); return null; } }); @@ -249,8 +249,8 @@ public class JmsTemplate102Tests extends TestCase { template.execute(new ProducerCallback() { @Override public Object doInJms(Session session, MessageProducer producer) throws JMSException { - boolean b = session.getTransacted(); - int i = producer.getPriority(); + session.getTransacted(); + producer.getPriority(); return null; } }); diff --git a/spring-jms/src/test/java/org/springframework/jms/core/JmsTemplateTests.java b/spring-jms/src/test/java/org/springframework/jms/core/JmsTemplateTests.java index 500874d8a1..2ff2c9afda 100644 --- a/spring-jms/src/test/java/org/springframework/jms/core/JmsTemplateTests.java +++ b/spring-jms/src/test/java/org/springframework/jms/core/JmsTemplateTests.java @@ -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. @@ -190,8 +190,8 @@ public class JmsTemplateTests extends TestCase { template.execute(new ProducerCallback() { @Override public Object doInJms(Session session, MessageProducer producer) throws JMSException { - boolean b = session.getTransacted(); - int i = producer.getPriority(); + session.getTransacted(); + producer.getPriority(); return null; } }); @@ -234,8 +234,8 @@ public class JmsTemplateTests extends TestCase { template.execute(new ProducerCallback() { @Override public Object doInJms(Session session, MessageProducer producer) throws JMSException { - boolean b = session.getTransacted(); - int i = producer.getPriority(); + session.getTransacted(); + producer.getPriority(); return null; } }); @@ -264,7 +264,7 @@ public class JmsTemplateTests extends TestCase { template.execute(new SessionCallback() { @Override public Object doInJms(Session session) throws JMSException { - boolean b = session.getTransacted(); + session.getTransacted(); return null; } }); @@ -303,14 +303,14 @@ public class JmsTemplateTests extends TestCase { template.execute(new SessionCallback() { @Override public Object doInJms(Session session) throws JMSException { - boolean b = session.getTransacted(); + session.getTransacted(); return null; } }); template.execute(new SessionCallback() { @Override public Object doInJms(Session session) throws JMSException { - boolean b = session.getTransacted(); + session.getTransacted(); return null; } }); @@ -321,7 +321,7 @@ public class JmsTemplateTests extends TestCase { TransactionAwareConnectionFactoryProxy tacf = new TransactionAwareConnectionFactoryProxy(scf); Connection tac = tacf.createConnection(); Session tas = tac.createSession(false, Session.AUTO_ACKNOWLEDGE); - boolean b = tas.getTransacted(); + tas.getTransacted(); tas.close(); tac.close(); diff --git a/spring-orm/src/test/java/org/springframework/orm/jpa/ApplicationManagedEntityManagerIntegrationTests.java b/spring-orm/src/test/java/org/springframework/orm/jpa/ApplicationManagedEntityManagerIntegrationTests.java index 23f241e5ab..920099caf9 100644 --- a/spring-orm/src/test/java/org/springframework/orm/jpa/ApplicationManagedEntityManagerIntegrationTests.java +++ b/spring-orm/src/test/java/org/springframework/orm/jpa/ApplicationManagedEntityManagerIntegrationTests.java @@ -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. @@ -48,6 +48,7 @@ public class ApplicationManagedEntityManagerIntegrationTests extends AbstractEnt assertTrue(Proxy.isProxyClass(em.getClass())); Query q = em.createQuery("select p from Person as p"); List people = q.getResultList(); + assertNotNull(people); assertTrue("Should be open to start with", em.isOpen()); em.close(); diff --git a/spring-tx/src/test/java/org/springframework/transaction/interceptor/AbstractTransactionAspectTests.java b/spring-tx/src/test/java/org/springframework/transaction/interceptor/AbstractTransactionAspectTests.java index 2b01ef4a91..0a49a21b63 100644 --- a/spring-tx/src/test/java/org/springframework/transaction/interceptor/AbstractTransactionAspectTests.java +++ b/spring-tx/src/test/java/org/springframework/transaction/interceptor/AbstractTransactionAspectTests.java @@ -539,7 +539,7 @@ public abstract class AbstractTransactionAspectTests extends TestCase { Method m = setNameMethod; MapTransactionAttributeSource tas = new MapTransactionAttributeSource(); tas.register(m, txatt); - Method m2 = getNameMethod; + // Method m2 = getNameMethod; // No attributes for m2 MockControl ptmControl = MockControl.createControl(PlatformTransactionManager.class); diff --git a/spring-tx/src/test/java/org/springframework/transaction/interceptor/BeanFactoryTransactionTests.java b/spring-tx/src/test/java/org/springframework/transaction/interceptor/BeanFactoryTransactionTests.java index 1ff4a262f4..1dda314dda 100644 --- a/spring-tx/src/test/java/org/springframework/transaction/interceptor/BeanFactoryTransactionTests.java +++ b/spring-tx/src/test/java/org/springframework/transaction/interceptor/BeanFactoryTransactionTests.java @@ -163,6 +163,7 @@ public class BeanFactoryTransactionTests extends TestCase { public void testGetBeansOfTypeWithAbstract() { Map beansOfType = factory.getBeansOfType(ITestBean.class, true, true); + assertNotNull(beansOfType); } /** @@ -172,7 +173,7 @@ public class BeanFactoryTransactionTests extends TestCase { try { DefaultListableBeanFactory bf = new DefaultListableBeanFactory(); new XmlBeanDefinitionReader(bf).loadBeanDefinitions(new ClassPathResource("noTransactionAttributeSource.xml", getClass())); - ITestBean testBean = (ITestBean) bf.getBean("noTransactionAttributeSource"); + bf.getBean("noTransactionAttributeSource"); fail("Should require TransactionAttributeSource to be set"); } catch (FatalBeanException ex) { diff --git a/spring-web/src/test/java/org/springframework/http/client/StreamingSimpleHttpRequestFactoryTests.java b/spring-web/src/test/java/org/springframework/http/client/StreamingSimpleHttpRequestFactoryTests.java index ccb91450a4..6eed7ae1be 100644 --- a/spring-web/src/test/java/org/springframework/http/client/StreamingSimpleHttpRequestFactoryTests.java +++ b/spring-web/src/test/java/org/springframework/http/client/StreamingSimpleHttpRequestFactoryTests.java @@ -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. @@ -81,7 +81,7 @@ public class StreamingSimpleHttpRequestFactoryTests extends AbstractHttpRequestF ClientHttpRequest request = factory.createRequest(new URI(baseUrl + "/methods/post"), HttpMethod.POST); final int BUF_SIZE = 4096; final int ITERATIONS = Integer.MAX_VALUE / BUF_SIZE; - final int contentLength = ITERATIONS * BUF_SIZE; +// final int contentLength = ITERATIONS * BUF_SIZE; // request.getHeaders().setContentLength(contentLength); OutputStream body = request.getBody(); for (int i = 0; i < ITERATIONS; i++) { diff --git a/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/annotation/ResponseStatusExceptionResolverTests.java b/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/annotation/ResponseStatusExceptionResolverTests.java index 25348f53f7..4731ce6fed 100644 --- a/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/annotation/ResponseStatusExceptionResolverTests.java +++ b/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/annotation/ResponseStatusExceptionResolverTests.java @@ -63,7 +63,7 @@ public class ResponseStatusExceptionResolverTests { exceptionResolver.setMessageSource(messageSource); StatusCodeAndReasonMessageException ex = new StatusCodeAndReasonMessageException(); - ModelAndView mav = exceptionResolver.resolveException(request, response, null, ex); + exceptionResolver.resolveException(request, response, null, ex); assertEquals("Invalid status reason", "Gone reason message", response.getErrorMessage()); } finally { diff --git a/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/multiaction/MultiActionControllerTests.java b/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/multiaction/MultiActionControllerTests.java index 64de09b05a..de40940d0d 100644 --- a/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/multiaction/MultiActionControllerTests.java +++ b/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/multiaction/MultiActionControllerTests.java @@ -453,7 +453,7 @@ public class MultiActionControllerTests extends TestCase { MockHttpServletRequest request = new MockHttpServletRequest("GET", "/handleIllegalStateException.html"); MockHttpServletResponse response = new MockHttpServletResponse(); - ModelAndView mav = mac.handleRequest(request, response); + mac.handleRequest(request, response); assertEquals(HttpServletResponse.SC_NOT_FOUND, response.getStatus()); } @@ -524,7 +524,6 @@ public class MultiActionControllerTests extends TestCase { this.invoked.put("commandNoSession", Boolean.TRUE); String pname = request.getParameter("name"); - String page = request.getParameter("age"); // ALLOW FOR NULL if (pname == null) { assertTrue("name null", command.getName() == null); @@ -532,6 +531,8 @@ public class MultiActionControllerTests extends TestCase { else { assertTrue("name param set", pname.equals(command.getName())); } + + //String page = request.getParameter("age"); // if (page == null) // assertTrue("age default", command.getAge() == 0); // else diff --git a/spring-webmvc/src/test/java/org/springframework/web/servlet/view/ResourceBundleViewResolverTests.java b/spring-webmvc/src/test/java/org/springframework/web/servlet/view/ResourceBundleViewResolverTests.java index b100a6a68e..19e4551fb3 100644 --- a/spring-webmvc/src/test/java/org/springframework/web/servlet/view/ResourceBundleViewResolverTests.java +++ b/spring-webmvc/src/test/java/org/springframework/web/servlet/view/ResourceBundleViewResolverTests.java @@ -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. @@ -72,14 +72,14 @@ public class ResourceBundleViewResolverTests extends TestCase { public void testParentsAreAbstract() throws Exception { try { - View v = rb.resolveViewName("debug.Parent", Locale.ENGLISH); + rb.resolveViewName("debug.Parent", Locale.ENGLISH); fail("Should have thrown BeanIsAbstractException"); } catch (BeanIsAbstractException ex) { // expected } try { - View v = rb.resolveViewName("testParent", Locale.ENGLISH); + rb.resolveViewName("testParent", Locale.ENGLISH); fail("Should have thrown BeanIsAbstractException"); } catch (BeanIsAbstractException ex) { @@ -152,7 +152,7 @@ public class ResourceBundleViewResolverTests extends TestCase { public void testNoSuchBasename() throws Exception { try { rb.setBasename("weoriwoierqupowiuer"); - View v = rb.resolveViewName("debugView", Locale.ENGLISH); + rb.resolveViewName("debugView", Locale.ENGLISH); fail("No such basename: all requests should fail with exception"); } catch (MissingResourceException ex) { diff --git a/src/test/java/org/springframework/context/annotation/jsr330/ClassPathBeanDefinitionScannerJsr330ScopeIntegrationTests.java b/src/test/java/org/springframework/context/annotation/jsr330/ClassPathBeanDefinitionScannerJsr330ScopeIntegrationTests.java index b213a2a4e0..5f5938ed36 100644 --- a/src/test/java/org/springframework/context/annotation/jsr330/ClassPathBeanDefinitionScannerJsr330ScopeIntegrationTests.java +++ b/src/test/java/org/springframework/context/annotation/jsr330/ClassPathBeanDefinitionScannerJsr330ScopeIntegrationTests.java @@ -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. @@ -86,6 +86,7 @@ public class ClassPathBeanDefinitionScannerJsr330ScopeIntegrationTests { public void testPrototype() { ApplicationContext context = createContext(ScopedProxyMode.NO); ScopedTestBean bean = (ScopedTestBean) context.getBean("prototype"); + assertNotNull(bean); assertTrue(context.isPrototype("prototype")); assertFalse(context.isSingleton("prototype")); }