From 7e394ddb0ab987bdffe78e729d015421e213a0b8 Mon Sep 17 00:00:00 2001 From: dhgarrette Date: Fri, 20 Mar 2009 15:22:34 +0000 Subject: [PATCH] BATCH-1165: Fixed unit test that failed due to changed error message. --- .../configuration/xml/StepParserTests.java | 21 ++++++------------- 1 file changed, 6 insertions(+), 15 deletions(-) diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/StepParserTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/StepParserTests.java index 083954667..42359fbe5 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/StepParserTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/StepParserTests.java @@ -17,7 +17,6 @@ package org.springframework.batch.core.configuration.xml; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; import java.util.List; import java.util.Map; @@ -113,24 +112,16 @@ public class StepParserTests { "org/springframework/batch/core/configuration/xml/StepParserNoCommitIntervalOrCompletionPolicyTests-context.xml"); } - @Test + @Test(expected = BeanDefinitionParsingException.class) public void testTaskletStepWithBadStepListener() throws Exception { - loadContextWithBadListener("org/springframework/batch/core/configuration/xml/StepParserBadStepListenerTests-context.xml"); + String contextLocation = "org/springframework/batch/core/configuration/xml/StepParserBadStepListenerTests-context.xml"; + new XmlBeanFactory(new ClassPathResource(contextLocation)); } - @Test + @Test(expected = BeanDefinitionParsingException.class) public void testTaskletStepWithBadRetryListener() throws Exception { - loadContextWithBadListener("org/springframework/batch/core/configuration/xml/StepParserBadRetryListenerTests-context.xml"); - } - - private void loadContextWithBadListener(String contextLocation) { - try { - new XmlBeanFactory(new ClassPathResource(contextLocation)); - fail("Context should not load!"); - } - catch (BeanDefinitionParsingException e) { - assertTrue(e.getMessage().contains("'ref' and 'class'")); - } + String contextLocation = "org/springframework/batch/core/configuration/xml/StepParserBadRetryListenerTests-context.xml"; + new XmlBeanFactory(new ClassPathResource(contextLocation)); } @Test(expected = BeanDefinitionParsingException.class)