Whitespace polishing: leading spaces->tabs; updated eclipse configuration to default to leading tabs for all bundles

This commit is contained in:
Chris Beams
2008-12-18 14:50:25 +00:00
parent 0f521c3bfb
commit 579280d7bf
87 changed files with 4294 additions and 654 deletions

View File

@@ -25,21 +25,21 @@ import org.springframework.beans.factory.access.BeanFactoryLocator;
*/
public class DefaultLocatorFactoryTests extends TestCase {
/*
* Class to test for BeanFactoryLocator getInstance()
*/
public void testGetInstance() {
BeanFactoryLocator bf = DefaultLocatorFactory.getInstance();
BeanFactoryLocator bf2 = DefaultLocatorFactory.getInstance();
assertTrue(bf.equals(bf2));
}
/*
* Class to test for BeanFactoryLocator getInstance()
*/
public void testGetInstance() {
BeanFactoryLocator bf = DefaultLocatorFactory.getInstance();
BeanFactoryLocator bf2 = DefaultLocatorFactory.getInstance();
assertTrue(bf.equals(bf2));
}
/*
* Class to test for BeanFactoryLocator getInstance(String)
*/
public void testGetInstanceString() {
BeanFactoryLocator bf = DefaultLocatorFactory.getInstance("my-bean-refs.xml");
BeanFactoryLocator bf2 = DefaultLocatorFactory.getInstance("my-bean-refs.xml");
assertTrue(bf.equals(bf2));
}
/*
* Class to test for BeanFactoryLocator getInstance(String)
*/
public void testGetInstanceString() {
BeanFactoryLocator bf = DefaultLocatorFactory.getInstance("my-bean-refs.xml");
BeanFactoryLocator bf2 = DefaultLocatorFactory.getInstance("my-bean-refs.xml");
assertTrue(bf.equals(bf2));
}
}

View File

@@ -26,12 +26,12 @@ import org.springframework.beans.factory.FactoryBean;
public class TestProxyFactoryBean extends AbstractSingletonProxyFactoryBean
implements FactoryBean, BeanFactoryAware {
@Override
protected Object createMainInterceptor() {
return new NoOpAdvice();
}
@Override
protected Object createMainInterceptor() {
return new NoOpAdvice();
}
public void setBeanFactory(BeanFactory beanFactory) throws BeansException {
}
public void setBeanFactory(BeanFactory beanFactory) throws BeansException {
}
}

View File

@@ -43,15 +43,15 @@ public class LocalSlsbInvokerInterceptorTests {
public void testPerformsLookup() throws Exception {
LocalInterfaceWithBusinessMethods ejb = createMock(LocalInterfaceWithBusinessMethods.class);
replay(ejb);
String jndiName= "foobar";
Context mockContext = mockContext(jndiName, ejb);
configuredInterceptor(mockContext, jndiName);
verify(mockContext);
}
@Test
public void testLookupFailure() throws Exception {
final NamingException nex = new NamingException();
@@ -62,7 +62,7 @@ public class LocalSlsbInvokerInterceptorTests {
throw nex;
}
};
LocalSlsbInvokerInterceptor si = new LocalSlsbInvokerInterceptor();
si.setJndiName("foobar");
// default resourceRef=false should cause this to fail, as java:/comp/env will not
@@ -76,7 +76,7 @@ public class LocalSlsbInvokerInterceptorTests {
assertTrue(ex == nex);
}
}
@Test
public void testInvokesMethodOnEjbInstance() throws Exception {
Object retVal = new Object();
@@ -84,22 +84,22 @@ public class LocalSlsbInvokerInterceptorTests {
expect(ejb.targetMethod()).andReturn(retVal);
ejb.remove();
replay(ejb);
String jndiName= "foobar";
Context mockContext = mockContext(jndiName, ejb);
LocalSlsbInvokerInterceptor si = configuredInterceptor(mockContext, jndiName);
ProxyFactory pf = new ProxyFactory(new Class[] { BusinessMethods.class } );
pf.addAdvice(si);
BusinessMethods target = (BusinessMethods) pf.getProxy();
assertTrue(target.targetMethod() == retVal);
verify(mockContext);
verify(ejb);
}
@Test
public void testInvokesMethodOnEjbInstanceWithSeparateBusinessMethods() throws Exception {
Object retVal = new Object();
@@ -148,7 +148,7 @@ public class LocalSlsbInvokerInterceptorTests {
verify(mockContext);
verify(ejb);
}
@Test
public void testApplicationException() throws Exception {
testException(new ApplicationException());
@@ -160,15 +160,15 @@ public class LocalSlsbInvokerInterceptorTests {
final SlsbHome mockHome = createMock(SlsbHome.class);
expect(mockHome.create()).andReturn((LocalInterface)ejbInstance);
replay(mockHome);
final Context mockCtx = createMock(Context.class);
expect(mockCtx.lookup("java:comp/env/" + jndiName)).andReturn(mockHome);
mockCtx.close();
replay(mockCtx);
return mockCtx;
}
protected LocalSlsbInvokerInterceptor configuredInterceptor(final Context mockCtx, final String jndiName)
throws Exception {
@@ -181,11 +181,11 @@ public class LocalSlsbInvokerInterceptorTests {
si.setJndiName(jndiName);
si.setResourceRef(true);
si.afterPropertiesSet();
return si;
}
/**
* Needed so that we can mock the create() method.
*/
@@ -212,11 +212,11 @@ public class LocalSlsbInvokerInterceptorTests {
@SuppressWarnings("serial")
private class ApplicationException extends Exception {
private class ApplicationException extends Exception {
public ApplicationException() {
super("appException");
}
}
}

View File

@@ -140,7 +140,7 @@ public class SimpleRemoteSlsbInvokerInterceptorTests {
assertTrue(ex == nex);
}
}
@Test
public void testInvokesMethodOnEjbInstance() throws Exception {
doTestInvokesMethodOnEjbInstance(true, true);
@@ -178,7 +178,7 @@ public class SimpleRemoteSlsbInvokerInterceptorTests {
final String jndiName= "foobar";
Context mockContext = mockContext(jndiName, ejb, 2, lookupCount, lookupCount);
SimpleRemoteSlsbInvokerInterceptor si = configuredInterceptor(mockContext, jndiName);
si.setLookupHomeOnStartup(lookupHomeOnStartup);
si.setCacheHome(cacheHome);
@@ -391,7 +391,7 @@ public class SimpleRemoteSlsbInvokerInterceptorTests {
@SuppressWarnings("serial")
protected class ApplicationException extends Exception {
protected class ApplicationException extends Exception {
public ApplicationException() {
super("appException");

View File

@@ -34,22 +34,22 @@ import org.springframework.jmx.export.SpringModelMBean;
*/
public final class ModelMBeanNotificationPublisherTests {
@Test(expected=IllegalArgumentException.class)
@Test(expected=IllegalArgumentException.class)
public void testCtorWithNullMBean() throws Exception {
new ModelMBeanNotificationPublisher(null, createObjectName(), this);
new ModelMBeanNotificationPublisher(null, createObjectName(), this);
}
@Test(expected=IllegalArgumentException.class)
@Test(expected=IllegalArgumentException.class)
public void testCtorWithNullObjectName() throws Exception {
new ModelMBeanNotificationPublisher(new SpringModelMBean(), null, this);
}
@Test(expected=IllegalArgumentException.class)
@Test(expected=IllegalArgumentException.class)
public void testCtorWithNullManagedResource() throws Exception {
new ModelMBeanNotificationPublisher(new SpringModelMBean(), createObjectName(), null);
}
@Test(expected=IllegalArgumentException.class)
@Test(expected=IllegalArgumentException.class)
public void testSendNullNotification() throws Exception {
NotificationPublisher publisher
= new ModelMBeanNotificationPublisher(new SpringModelMBean(), createObjectName(), this);

View File

@@ -35,7 +35,7 @@ import org.springframework.mock.jndi.ExpectedLookupTemplate;
*/
public class JndiObjectFactoryBeanTests {
@Test
@Test
public void testNoJndiName() throws NamingException {
JndiObjectFactoryBean jof = new JndiObjectFactoryBean();
try {
@@ -45,8 +45,8 @@ public class JndiObjectFactoryBeanTests {
catch (IllegalArgumentException ex) {
}
}
@Test
@Test
public void testLookupWithFullNameAndResourceRefTrue() throws Exception {
JndiObjectFactoryBean jof = new JndiObjectFactoryBean();
Object o = new Object();
@@ -57,7 +57,7 @@ public class JndiObjectFactoryBeanTests {
assertTrue(jof.getObject() == o);
}
@Test
@Test
public void testLookupWithFullNameAndResourceRefFalse() throws Exception {
JndiObjectFactoryBean jof = new JndiObjectFactoryBean();
Object o = new Object();
@@ -68,7 +68,7 @@ public class JndiObjectFactoryBeanTests {
assertTrue(jof.getObject() == o);
}
@Test
@Test
public void testLookupWithSchemeNameAndResourceRefTrue() throws Exception {
JndiObjectFactoryBean jof = new JndiObjectFactoryBean();
Object o = new Object();
@@ -79,7 +79,7 @@ public class JndiObjectFactoryBeanTests {
assertTrue(jof.getObject() == o);
}
@Test
@Test
public void testLookupWithSchemeNameAndResourceRefFalse() throws Exception {
JndiObjectFactoryBean jof = new JndiObjectFactoryBean();
Object o = new Object();
@@ -90,7 +90,7 @@ public class JndiObjectFactoryBeanTests {
assertTrue(jof.getObject() == o);
}
@Test
@Test
public void testLookupWithShortNameAndResourceRefTrue() throws Exception {
JndiObjectFactoryBean jof = new JndiObjectFactoryBean();
Object o = new Object();
@@ -101,7 +101,7 @@ public class JndiObjectFactoryBeanTests {
assertTrue(jof.getObject() == o);
}
@Test
@Test
public void testLookupWithShortNameAndResourceRefFalse() throws Exception {
JndiObjectFactoryBean jof = new JndiObjectFactoryBean();
Object o = new Object();
@@ -117,7 +117,7 @@ public class JndiObjectFactoryBeanTests {
}
}
@Test
@Test
public void testLookupWithArbitraryNameAndResourceRefFalse() throws Exception {
JndiObjectFactoryBean jof = new JndiObjectFactoryBean();
Object o = new Object();
@@ -128,7 +128,7 @@ public class JndiObjectFactoryBeanTests {
assertTrue(jof.getObject() == o);
}
@Test
@Test
public void testLookupWithExpectedTypeAndMatch() throws Exception {
JndiObjectFactoryBean jof = new JndiObjectFactoryBean();
String s = "";
@@ -139,7 +139,7 @@ public class JndiObjectFactoryBeanTests {
assertTrue(jof.getObject() == s);
}
@Test
@Test
public void testLookupWithExpectedTypeAndNoMatch() throws Exception {
JndiObjectFactoryBean jof = new JndiObjectFactoryBean();
Object o = new Object();
@@ -155,7 +155,7 @@ public class JndiObjectFactoryBeanTests {
}
}
@Test
@Test
public void testLookupWithDefaultObject() throws Exception {
JndiObjectFactoryBean jof = new JndiObjectFactoryBean();
String s = "";
@@ -167,7 +167,7 @@ public class JndiObjectFactoryBeanTests {
assertEquals("myString", jof.getObject());
}
@Test
@Test
public void testLookupWithDefaultObjectAndExpectedType() throws Exception {
JndiObjectFactoryBean jof = new JndiObjectFactoryBean();
String s = "";
@@ -179,7 +179,7 @@ public class JndiObjectFactoryBeanTests {
assertEquals("myString", jof.getObject());
}
@Test
@Test
public void testLookupWithDefaultObjectAndExpectedTypeNoMatch() throws Exception {
JndiObjectFactoryBean jof = new JndiObjectFactoryBean();
String s = "";
@@ -196,7 +196,7 @@ public class JndiObjectFactoryBeanTests {
}
}
@Test
@Test
public void testLookupWithProxyInterface() throws Exception {
JndiObjectFactoryBean jof = new JndiObjectFactoryBean();
TestBean tb = new TestBean();
@@ -211,7 +211,7 @@ public class JndiObjectFactoryBeanTests {
assertEquals(99, tb.getAge());
}
@Test
@Test
public void testLookupWithProxyInterfaceAndDefaultObject() throws Exception {
JndiObjectFactoryBean jof = new JndiObjectFactoryBean();
TestBean tb = new TestBean();
@@ -228,7 +228,7 @@ public class JndiObjectFactoryBeanTests {
}
}
@Test
@Test
public void testLookupWithProxyInterfaceAndLazyLookup() throws Exception {
JndiObjectFactoryBean jof = new JndiObjectFactoryBean();
final TestBean tb = new TestBean();
@@ -254,7 +254,7 @@ public class JndiObjectFactoryBeanTests {
assertEquals(99, tb.getAge());
}
@Test
@Test
public void testLookupWithProxyInterfaceWithNotCache() throws Exception {
JndiObjectFactoryBean jof = new JndiObjectFactoryBean();
final TestBean tb = new TestBean();
@@ -282,7 +282,7 @@ public class JndiObjectFactoryBeanTests {
assertEquals(4, tb.getAge());
}
@Test
@Test
public void testLookupWithProxyInterfaceWithLazyLookupAndNotCache() throws Exception {
JndiObjectFactoryBean jof = new JndiObjectFactoryBean();
final TestBean tb = new TestBean();
@@ -314,7 +314,7 @@ public class JndiObjectFactoryBeanTests {
assertEquals(4, tb.getAge());
}
@Test
@Test
public void testLazyLookupWithoutProxyInterface() throws NamingException {
JndiObjectFactoryBean jof = new JndiObjectFactoryBean();
jof.setJndiName("foo");
@@ -328,7 +328,7 @@ public class JndiObjectFactoryBeanTests {
}
}
@Test
@Test
public void testNotCacheWithoutProxyInterface() throws NamingException {
JndiObjectFactoryBean jof = new JndiObjectFactoryBean();
jof.setJndiName("foo");
@@ -343,7 +343,7 @@ public class JndiObjectFactoryBeanTests {
}
}
@Test
@Test
public void testLookupWithProxyInterfaceAndExpectedTypeAndMatch() throws Exception {
JndiObjectFactoryBean jof = new JndiObjectFactoryBean();
TestBean tb = new TestBean();
@@ -359,7 +359,7 @@ public class JndiObjectFactoryBeanTests {
assertEquals(99, tb.getAge());
}
@Test
@Test
public void testLookupWithProxyInterfaceAndExpectedTypeAndNoMatch() {
JndiObjectFactoryBean jof = new JndiObjectFactoryBean();
TestBean tb = new TestBean();
@@ -376,7 +376,7 @@ public class JndiObjectFactoryBeanTests {
}
}
@Test
@Test
public void testLookupWithExposeAccessContext() throws Exception {
JndiObjectFactoryBean jof = new JndiObjectFactoryBean();
TestBean tb = new TestBean();

View File

@@ -27,7 +27,7 @@ import org.junit.Test;
*/
public class JndiTemplateEditorTests {
@Test
@Test
public void testNullIsIllegalArgument() {
try {
new JndiTemplateEditor().setAsText(null);
@@ -37,16 +37,16 @@ public class JndiTemplateEditorTests {
// OK
}
}
@Test
@Test
public void testEmptyStringMeansNullEnvironment() {
JndiTemplateEditor je = new JndiTemplateEditor();
je.setAsText("");
JndiTemplate jt = (JndiTemplate) je.getValue();
assertTrue(jt.getEnvironment() == null);
}
@Test
@Test
public void testCustomEnvironment() {
JndiTemplateEditor je = new JndiTemplateEditor();
// These properties are meaningless for JNDI, but we don't worry about that:

View File

@@ -32,7 +32,7 @@ import org.junit.Test;
*/
public class JndiTemplateTests {
@Test
@Test
public void testLookupSucceeds() throws Exception {
Object o = new Object();
String name = "foo";
@@ -51,8 +51,8 @@ public class JndiTemplateTests {
assertEquals(o, o2);
verify(context);
}
@Test
@Test
public void testLookupFails() throws Exception {
NameNotFoundException ne = new NameNotFoundException();
String name = "foo";
@@ -76,8 +76,8 @@ public class JndiTemplateTests {
}
verify(context);
}
@Test
@Test
public void testLookupReturnsNull() throws Exception {
String name = "foo";
final Context context = createMock(Context.class);
@@ -101,7 +101,7 @@ public class JndiTemplateTests {
verify(context);
}
@Test
@Test
public void testLookupFailsWithTypeMismatch() throws Exception {
Object o = new Object();
String name = "foo";
@@ -126,7 +126,7 @@ public class JndiTemplateTests {
verify(context);
}
@Test
@Test
public void testBind() throws Exception {
Object o = new Object();
String name = "foo";
@@ -134,18 +134,18 @@ public class JndiTemplateTests {
context.bind(name, o);
context.close();
replay(context);
JndiTemplate jt = new JndiTemplate() {
protected Context createInitialContext() {
return context;
}
};
jt.bind(name, o);
verify(context);
}
@Test
@Test
public void testRebind() throws Exception {
Object o = new Object();
String name = "foo";
@@ -164,20 +164,20 @@ public class JndiTemplateTests {
verify(context);
}
@Test
@Test
public void testUnbind() throws Exception {
String name = "something";
final Context context = createMock(Context.class);
context.unbind(name);
context.close();
replay(context);
JndiTemplate jt = new JndiTemplate() {
protected Context createInitialContext() {
return context;
}
};
jt.unbind(name);
verify(context);
}

View File

@@ -46,7 +46,7 @@ import org.springframework.mock.jndi.SimpleNamingContextBuilder;
*/
public class SimpleNamingContextTests {
@Test
@Test
public void testNamingContextBuilder() throws NamingException {
SimpleNamingContextBuilder builder = new SimpleNamingContextBuilder();
InitialContextFactory factory = builder.createInitialContextFactory(null);
@@ -174,12 +174,12 @@ public class SimpleNamingContextTests {
assertTrue("Correct DataSource registered", StubDataSource.class.getName().equals(pairMap.get("myds")));
assertTrue("Correct DataSource registered", StubDataSource.class.getName().equals(pairMap.get("mydsX")));
}
/**
* Demonstrates how emptyActivatedContextBuilder() method can be
* used repeatedly, and how it affects creating a new InitialContext()
*/
@Test
@Test
public void testCreateInitialContext() throws Exception {
SimpleNamingContextBuilder builder = SimpleNamingContextBuilder.emptyActivatedContextBuilder();
String name = "foo";
@@ -198,7 +198,7 @@ public class SimpleNamingContextTests {
catch (NamingException ex) {
// expected
}
// Check the same call will work again, but the context is empty
builder = SimpleNamingContextBuilder.emptyActivatedContextBuilder();
try {
@@ -218,36 +218,36 @@ public class SimpleNamingContextTests {
class StubDataSource implements DataSource {
public Connection getConnection() throws SQLException {
return null;
}
public Connection getConnection() throws SQLException {
return null;
}
public Connection getConnection(String username, String password) throws SQLException {
return null;
}
public Connection getConnection(String username, String password) throws SQLException {
return null;
}
public PrintWriter getLogWriter() throws SQLException {
return null;
}
public PrintWriter getLogWriter() throws SQLException {
return null;
}
public int getLoginTimeout() throws SQLException {
return 0;
}
public int getLoginTimeout() throws SQLException {
return 0;
}
public void setLogWriter(PrintWriter arg0) throws SQLException {
}
public void setLogWriter(PrintWriter arg0) throws SQLException {
public void setLoginTimeout(int arg0) throws SQLException {
}
}
public boolean isWrapperFor(Class<?> arg0) throws SQLException {
return false;
}
public void setLoginTimeout(int arg0) throws SQLException {
}
public boolean isWrapperFor(Class<?> arg0) throws SQLException {
return false;
}
public <T> T unwrap(Class<T> arg0) throws SQLException {
return null;
}
public <T> T unwrap(Class<T> arg0) throws SQLException {
return null;
}
}

View File

@@ -56,7 +56,7 @@ import org.springframework.scripting.support.ScriptFactoryPostProcessor;
*/
public class GroovyScriptFactoryTests {
@Test
@Test
public void testStaticScript() throws Exception {
ApplicationContext ctx = new ClassPathXmlApplicationContext("groovyContext.xml", getClass());
@@ -85,7 +85,7 @@ public class GroovyScriptFactoryTests {
assertTrue(ctx.getBeansOfType(Messenger.class).values().contains(messenger));
}
@Test
@Test
public void testStaticPrototypeScript() throws Exception {
ApplicationContext ctx = new ClassPathXmlApplicationContext("groovyContext.xml", getClass());
ConfigurableMessenger messenger = (ConfigurableMessenger) ctx.getBean("messengerPrototype");
@@ -104,7 +104,7 @@ public class GroovyScriptFactoryTests {
assertEquals("Byebye World!", messenger2.getMessage());
}
@Test
@Test
public void testStaticScriptWithInstance() throws Exception {
ApplicationContext ctx = new ClassPathXmlApplicationContext("groovyContext.xml", getClass());
assertTrue(Arrays.asList(ctx.getBeanNamesForType(Messenger.class)).contains("messengerInstance"));
@@ -118,7 +118,7 @@ public class GroovyScriptFactoryTests {
assertTrue(ctx.getBeansOfType(Messenger.class).values().contains(messenger));
}
@Test
@Test
public void testStaticScriptWithInlineDefinedInstance() throws Exception {
ApplicationContext ctx = new ClassPathXmlApplicationContext("groovyContext.xml", getClass());
assertTrue(Arrays.asList(ctx.getBeanNamesForType(Messenger.class)).contains("messengerInstanceInline"));
@@ -132,7 +132,7 @@ public class GroovyScriptFactoryTests {
assertTrue(ctx.getBeansOfType(Messenger.class).values().contains(messenger));
}
@Test
@Test
public void testNonStaticScript() throws Exception {
ApplicationContext ctx = new ClassPathXmlApplicationContext("groovyRefreshableContext.xml", getClass());
Messenger messenger = (Messenger) ctx.getBean("messenger");
@@ -150,7 +150,7 @@ public class GroovyScriptFactoryTests {
assertEquals("Incorrect refresh count", 2, refreshable.getRefreshCount());
}
@Test
@Test
public void testNonStaticPrototypeScript() throws Exception {
ApplicationContext ctx = new ClassPathXmlApplicationContext("groovyRefreshableContext.xml", getClass());
ConfigurableMessenger messenger = (ConfigurableMessenger) ctx.getBean("messengerPrototype");
@@ -174,7 +174,7 @@ public class GroovyScriptFactoryTests {
assertEquals("Incorrect refresh count", 2, refreshable.getRefreshCount());
}
@Test
@Test
public void testScriptCompilationException() throws Exception {
try {
new ClassPathXmlApplicationContext("org/springframework/scripting/groovy/groovyBrokenContext.xml");
@@ -185,7 +185,7 @@ public class GroovyScriptFactoryTests {
}
}
@Test
@Test
public void testScriptedClassThatDoesNotHaveANoArgCtor() throws Exception {
MockControl mock = MockControl.createControl(ScriptSource.class);
ScriptSource script = (ScriptSource) mock.getMock();
@@ -206,7 +206,7 @@ public class GroovyScriptFactoryTests {
mock.verify();
}
@Test
@Test
public void testScriptedClassThatHasNoPublicNoArgCtor() throws Exception {
MockControl mock = MockControl.createControl(ScriptSource.class);
ScriptSource script = (ScriptSource) mock.getMock();
@@ -227,7 +227,7 @@ public class GroovyScriptFactoryTests {
mock.verify();
}
@Test
@Test
public void testWithTwoClassesDefinedInTheOneGroovyFile_CorrectClassFirst() throws Exception {
ApplicationContext ctx = new ClassPathXmlApplicationContext("twoClassesCorrectOneFirst.xml", getClass());
Messenger messenger = (Messenger) ctx.getBean("messenger");
@@ -238,7 +238,7 @@ public class GroovyScriptFactoryTests {
GroovyObject goo = (GroovyObject) messenger;
}
@Test
@Test
public void testWithTwoClassesDefinedInTheOneGroovyFile_WrongClassFirst() throws Exception {
try {
ApplicationContext ctx = new ClassPathXmlApplicationContext("twoClassesWrongOneFirst.xml", getClass());
@@ -250,7 +250,7 @@ public class GroovyScriptFactoryTests {
}
}
@Test
@Test
public void testCtorWithNullScriptSourceLocator() throws Exception {
try {
new GroovyScriptFactory(null);
@@ -260,7 +260,7 @@ public class GroovyScriptFactoryTests {
}
}
@Test
@Test
public void testCtorWithEmptyScriptSourceLocator() throws Exception {
try {
new GroovyScriptFactory("");
@@ -270,7 +270,7 @@ public class GroovyScriptFactoryTests {
}
}
@Test
@Test
public void testCtorWithWhitespacedScriptSourceLocator() throws Exception {
try {
new GroovyScriptFactory("\n ");
@@ -280,7 +280,7 @@ public class GroovyScriptFactoryTests {
}
}
@Test
@Test
public void testWithInlineScriptWithLeadingWhitespace() throws Exception {
try {
new ClassPathXmlApplicationContext("lwspBadGroovyContext.xml", getClass());
@@ -291,7 +291,7 @@ public class GroovyScriptFactoryTests {
}
}
@Test
@Test
public void testGetScriptedObjectDoesNotChokeOnNullInterfacesBeingPassedIn() throws Exception {
MockControl mock = MockControl.createControl(ScriptSource.class);
ScriptSource scriptSource = (ScriptSource) mock.getMock();
@@ -307,7 +307,7 @@ public class GroovyScriptFactoryTests {
mock.verify();
}
@Test
@Test
public void testGetScriptedObjectDoesChokeOnNullScriptSourceBeingPassedIn() throws Exception {
GroovyScriptFactory factory = new GroovyScriptFactory("a script source locator (doesn't matter here)");
try {
@@ -318,7 +318,7 @@ public class GroovyScriptFactoryTests {
}
}
@Test
@Test
public void testResourceScriptFromTag() throws Exception {
ClassPathXmlApplicationContext ctx = new ClassPathXmlApplicationContext("groovy-with-xsd.xml", getClass());
Messenger messenger = (Messenger) ctx.getBean("messenger");
@@ -334,7 +334,7 @@ public class GroovyScriptFactoryTests {
assertEquals(-200, countingAspect.getCalls());
}
@Test
@Test
public void testPrototypeScriptFromTag() throws Exception {
ApplicationContext ctx = new ClassPathXmlApplicationContext("groovy-with-xsd.xml", getClass());
ConfigurableMessenger messenger = (ConfigurableMessenger) ctx.getBean("messengerPrototype");
@@ -350,7 +350,7 @@ public class GroovyScriptFactoryTests {
assertEquals("Byebye World!", messenger2.getMessage());
}
@Test
@Test
public void testInlineScriptFromTag() throws Exception {
ApplicationContext ctx = new ClassPathXmlApplicationContext("groovy-with-xsd.xml", getClass());
Calculator calculator = (Calculator) ctx.getBean("calculator");
@@ -358,7 +358,7 @@ public class GroovyScriptFactoryTests {
assertFalse(calculator instanceof Refreshable);
}
@Test
@Test
public void testRefreshableFromTag() throws Exception {
ApplicationContext ctx = new ClassPathXmlApplicationContext("groovy-with-xsd.xml", getClass());
assertTrue(Arrays.asList(ctx.getBeanNamesForType(Messenger.class)).contains("refreshableMessenger"));
@@ -375,7 +375,7 @@ public class GroovyScriptFactoryTests {
assertTrue(ctx.getBeansOfType(Messenger.class).values().contains(messenger));
}
@Test
@Test
public void testAnonymousScriptDetected() throws Exception {
ApplicationContext ctx = new ClassPathXmlApplicationContext("groovy-with-xsd.xml", getClass());
Map beans = ctx.getBeansOfType(Messenger.class);
@@ -386,7 +386,7 @@ public class GroovyScriptFactoryTests {
* Tests the SPR-2098 bug whereby no more than 1 property element could be
* passed to a scripted bean :(
*/
@Test
@Test
public void testCanPassInMoreThanOneProperty() {
ApplicationContext ctx = new ClassPathXmlApplicationContext("groovy-multiple-properties.xml", getClass());
TestBean tb = (TestBean) ctx.getBean("testBean");
@@ -411,26 +411,26 @@ public class GroovyScriptFactoryTests {
}
}
@Test
@Test
public void testMetaClassWithBeans() {
testMetaClass("org/springframework/scripting/groovy/calculators.xml");
}
@Test
@Test
public void testMetaClassWithXsd() {
testMetaClass("org/springframework/scripting/groovy/calculators-with-xsd.xml");
}
private void testMetaClass(final String xmlFile) {
// expect the exception we threw in the custom metaclass to show it got invoked
try {
try {
ApplicationContext ctx =
new ClassPathXmlApplicationContext(xmlFile);
Calculator calc = (Calculator) ctx.getBean("delegatingCalculator");
calc.add(1, 2);
fail("expected IllegalStateException");
} catch (IllegalStateException ex) {
assertEquals("Gotcha", ex.getMessage());
assertEquals("Gotcha", ex.getMessage());
}
}