Consistent formatting
This commit is contained in:
@@ -81,19 +81,22 @@ public final class ServiceLocatorFactoryBeanTests {
|
||||
TestServiceLocator factory = (TestServiceLocator) bf.getBean("factory");
|
||||
factory.getTestService();
|
||||
fail("Must fail on more than one matching type");
|
||||
} catch (NoSuchBeanDefinitionException ex) { /* expected */ }
|
||||
}
|
||||
catch (NoSuchBeanDefinitionException ex) { /* expected */ }
|
||||
|
||||
try {
|
||||
TestServiceLocator2 factory = (TestServiceLocator2) bf.getBean("factory2");
|
||||
factory.getTestService(null);
|
||||
fail("Must fail on more than one matching type");
|
||||
} catch (NoSuchBeanDefinitionException ex) { /* expected */ }
|
||||
}
|
||||
catch (NoSuchBeanDefinitionException ex) { /* expected */ }
|
||||
|
||||
try {
|
||||
TestService2Locator factory = (TestService2Locator) bf.getBean("factory3");
|
||||
factory.getTestService();
|
||||
fail("Must fail on no matching types");
|
||||
} catch (NoSuchBeanDefinitionException ex) { /* expected */ }
|
||||
}
|
||||
catch (NoSuchBeanDefinitionException ex) { /* expected */ }
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -138,7 +141,8 @@ public final class ServiceLocatorFactoryBeanTests {
|
||||
TestService2Locator factory3 = (TestService2Locator) bf.getBean("factory3");
|
||||
factory3.getTestService();
|
||||
fail("Must fail on no matching type");
|
||||
} catch (CustomServiceLocatorException3 ex) { /* expected */ }
|
||||
}
|
||||
catch (CustomServiceLocatorException3 ex) { /* expected */ }
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -160,7 +164,8 @@ public final class ServiceLocatorFactoryBeanTests {
|
||||
try {
|
||||
factory.getTestService("bogusTestService");
|
||||
fail("Illegal operation allowed");
|
||||
} catch (NoSuchBeanDefinitionException ex) { /* expected */ }
|
||||
}
|
||||
catch (NoSuchBeanDefinitionException ex) { /* expected */ }
|
||||
}
|
||||
|
||||
@Ignore @Test // worked when using an ApplicationContext (see commented), fails when using BeanFactory
|
||||
@@ -275,7 +280,8 @@ public final class ServiceLocatorFactoryBeanTests {
|
||||
try {
|
||||
ServiceLocatorFactoryBean factory = new ServiceLocatorFactoryBean();
|
||||
factory.setBeanFactory(beanFactory);
|
||||
} catch (FatalBeanException ex) {
|
||||
}
|
||||
catch (FatalBeanException ex) {
|
||||
// expected
|
||||
}
|
||||
}
|
||||
|
||||
@@ -324,7 +324,8 @@ public class CallbacksSecurityTests {
|
||||
try {
|
||||
acc.checkPermission(new PropertyPermission("*", "read"));
|
||||
fail("Acc should not have any permissions");
|
||||
} catch (SecurityException se) {
|
||||
}
|
||||
catch (SecurityException se) {
|
||||
// expected
|
||||
}
|
||||
|
||||
@@ -342,7 +343,8 @@ public class CallbacksSecurityTests {
|
||||
}
|
||||
}, acc);
|
||||
fail("expected security exception");
|
||||
} catch (Exception ex) {
|
||||
}
|
||||
catch (Exception ex) {
|
||||
}
|
||||
|
||||
final Class<ConstructorBean> cl = ConstructorBean.class;
|
||||
@@ -356,7 +358,8 @@ public class CallbacksSecurityTests {
|
||||
}
|
||||
}, acc);
|
||||
fail("expected security exception");
|
||||
} catch (Exception ex) {
|
||||
}
|
||||
catch (Exception ex) {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -365,7 +368,8 @@ public class CallbacksSecurityTests {
|
||||
try {
|
||||
beanFactory.getBean("spring-init");
|
||||
fail("expected security exception");
|
||||
} catch (BeanCreationException ex) {
|
||||
}
|
||||
catch (BeanCreationException ex) {
|
||||
assertTrue(ex.getCause() instanceof SecurityException);
|
||||
}
|
||||
}
|
||||
@@ -375,7 +379,8 @@ public class CallbacksSecurityTests {
|
||||
try {
|
||||
beanFactory.getBean("custom-init");
|
||||
fail("expected security exception");
|
||||
} catch (BeanCreationException ex) {
|
||||
}
|
||||
catch (BeanCreationException ex) {
|
||||
assertTrue(ex.getCause() instanceof SecurityException);
|
||||
}
|
||||
}
|
||||
@@ -399,7 +404,8 @@ public class CallbacksSecurityTests {
|
||||
try {
|
||||
beanFactory.getBean("spring-factory");
|
||||
fail("expected security exception");
|
||||
} catch (BeanCreationException ex) {
|
||||
}
|
||||
catch (BeanCreationException ex) {
|
||||
assertTrue(ex.getCause() instanceof SecurityException);
|
||||
}
|
||||
|
||||
@@ -416,7 +422,8 @@ public class CallbacksSecurityTests {
|
||||
try {
|
||||
beanFactory.getBean("custom-static-factory-method");
|
||||
fail("expected security exception");
|
||||
} catch (BeanCreationException ex) {
|
||||
}
|
||||
catch (BeanCreationException ex) {
|
||||
assertTrue(ex.getMostSpecificCause() instanceof SecurityException);
|
||||
}
|
||||
}
|
||||
@@ -426,7 +433,8 @@ public class CallbacksSecurityTests {
|
||||
try {
|
||||
beanFactory.getBean("custom-factory-method");
|
||||
fail("expected security exception");
|
||||
} catch (BeanCreationException ex) {
|
||||
}
|
||||
catch (BeanCreationException ex) {
|
||||
assertTrue(ex.getMostSpecificCause() instanceof SecurityException);
|
||||
}
|
||||
}
|
||||
@@ -436,7 +444,8 @@ public class CallbacksSecurityTests {
|
||||
try {
|
||||
beanFactory.getBean("privileged-static-factory-method");
|
||||
fail("expected security exception");
|
||||
} catch (BeanCreationException ex) {
|
||||
}
|
||||
catch (BeanCreationException ex) {
|
||||
assertTrue(ex.getMostSpecificCause() instanceof SecurityException);
|
||||
}
|
||||
}
|
||||
@@ -446,7 +455,8 @@ public class CallbacksSecurityTests {
|
||||
try {
|
||||
beanFactory.getBean("constructor");
|
||||
fail("expected security exception");
|
||||
} catch (BeanCreationException ex) {
|
||||
}
|
||||
catch (BeanCreationException ex) {
|
||||
// expected
|
||||
assertTrue(ex.getMostSpecificCause() instanceof SecurityException);
|
||||
}
|
||||
@@ -472,7 +482,8 @@ public class CallbacksSecurityTests {
|
||||
try {
|
||||
beanFactory.getBean("property-injection");
|
||||
fail("expected security exception");
|
||||
} catch (BeanCreationException ex) {
|
||||
}
|
||||
catch (BeanCreationException ex) {
|
||||
assertTrue(ex.getMessage().contains("security"));
|
||||
}
|
||||
|
||||
|
||||
@@ -48,7 +48,8 @@ public class DuplicateBeanIdTests {
|
||||
try {
|
||||
reader.loadBeanDefinitions(new ClassPathResource("DuplicateBeanIdTests-sameLevel-context.xml", this.getClass()));
|
||||
fail("expected parsing exception due to duplicate ids in same nesting level");
|
||||
} catch (Exception ex) {
|
||||
}
|
||||
catch (Exception ex) {
|
||||
// expected
|
||||
}
|
||||
}
|
||||
|
||||
@@ -485,7 +485,8 @@ public class CustomEditorTests {
|
||||
CustomNumberEditor editor = new CustomNumberEditor(Short.class, true);
|
||||
editor.setAsText(String.valueOf(Short.MAX_VALUE + 1));
|
||||
fail(Short.MAX_VALUE + 1 + " is greater than max value");
|
||||
} catch (NumberFormatException ex) {
|
||||
}
|
||||
catch (NumberFormatException ex) {
|
||||
// expected
|
||||
}
|
||||
}
|
||||
|
||||
@@ -70,7 +70,7 @@ public class CollectingReaderEventListener implements ReaderEventListener {
|
||||
@Override
|
||||
public void aliasRegistered(AliasDefinition aliasDefinition) {
|
||||
List aliases = (List) this.aliasMap.get(aliasDefinition.getBeanName());
|
||||
if(aliases == null) {
|
||||
if (aliases == null) {
|
||||
aliases = new ArrayList();
|
||||
this.aliasMap.put(aliasDefinition.getBeanName(), aliases);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user