I launch the test using junit tool of Eclipse. Does removing @DirtiesContext help? No
When I use maven command : mvn clean install test. I can see the following error in the surefire reprot : ------------------------------------------------------------------------------- Test set: org.apache.camel.bindy.csv.BindyCSVUnmarshallTest ------------------------------------------------------------------------------- Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.125 sec <<< FAILURE! initializationError(org.apache.camel.bindy.csv.BindyCSVUnmarshallTest) Time elapsed: 0.031 sec <<< ERROR! java.lang.Exception: No runnable methods at org.junit.internal.runners.MethodValidator.validateInstanceMethods(MethodValidator.java:39) at org.junit.internal.runners.MethodValidator.validateMethodsForDefaultRunner(MethodValidator.java:50) at org.junit.internal.runners.JUnit4ClassRunner.validate(JUnit4ClassRunner.java:44) at org.junit.internal.runners.JUnit4ClassRunner.<init>(JUnit4ClassRunner.java:35) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.<init>(SpringJUnit4ClassRunner.java:76) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27) at java.lang.reflect.Constructor.newInstance(Constructor.java:494) at org.junit.internal.builders.AnnotatedBuilder.buildRunner(AnnotatedBuilder.java:31) at org.junit.internal.builders.AnnotatedBuilder.runnerForClass(AnnotatedBuilder.java:24) at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:57) at org.junit.internal.builders.AllDefaultPossibilitiesBuilder.runnerForClass(AllDefaultPossibilitiesBuilder.java:29) at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:57) at org.junit.internal.requests.ClassRequest.getRunner(ClassRequest.java:24) at org.apache.maven.surefire.junit4.JUnit4TestSet.<init>(JUnit4TestSet.java:45) at org.apache.maven.surefire.junit4.JUnit4DirectoryTestSuite.createTestSet(JUnit4DirectoryTestSuite.java:56) at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.locateTestSets(AbstractDirectoryTestSuite.java:96) at org.apache.maven.surefire.Surefire.createSuiteFromDefinition(Surefire.java:209) at org.apache.maven.surefire.Surefire.run(Surefire.java:156) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(SurefireBooter.java:338) at org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java:997) Do I have to add the tag '@Test' to the method that I want to test ? James.Strachan wrote: > > What happens when you try run it in maven or in your IDE? > > Does removing @DirtiesContext help? > > 2009/1/13 cmoulliard <cmoulli...@gmail.com>: >> >> Hi , >> >> I'm faced to a strange problem. The following code does not execute my >> test >> method (testMarshallMessage) but only (i presume because this is a value >> by >> default) testMocksAreValid : >> >> package org.apache.camel.bindy.csv; >> >> import org.apache.camel.EndpointInject; >> import org.apache.camel.Produce; >> import org.apache.camel.ProducerTemplate; >> import org.apache.camel.builder.RouteBuilder; >> import org.apache.camel.component.mock.MockEndpoint; >> import org.apache.camel.spring.javaconfig.SingleRouteCamelConfiguration; >> import org.apache.commons.logging.Log; >> import org.apache.commons.logging.LogFactory; >> import org.springframework.config.java.annotation.Bean; >> import org.springframework.config.java.annotation.Configuration; >> import org.springframework.config.java.test.JavaConfigContextLoader; >> import org.springframework.test.annotation.DirtiesContext; >> import org.springframework.test.context.ContextConfiguration; >> import >> org.springframework.test.context.junit4.AbstractJUnit4SpringContextTests; >> >> @ContextConfiguration(locations = >> "org.apache.camel.spring.javaconfig.patterns.FilterTest$ContextConfig", >> loader = JavaConfigContextLoader.class) >> public class BindyCSVUnmarshallTest extends >> AbstractJUnit4SpringContextTests >> { >> >> private static final transient Log LOG = LogFactory >> .getLog(BindyCSVUnmarshallTest.class); >> >> String record = "01,A,Albert,Cartier,BE12345678,Belgacom Ventage >> 10/10,1500,EUR,08-01-2009"; >> >> @EndpointInject(uri = "mock:result") >> protected MockEndpoint resultEndpoint; >> >> @Produce(uri = "direct:start") >> protected ProducerTemplate template; >> >> @DirtiesContext >> public void testMarshallMessage() throws Exception { >> >> template.sendBody(record); >> resultEndpoint.expectedBodiesReceived(record); >> } >> >> >> @Configuration >> public static class ContextConfig extends >> SingleRouteCamelConfiguration { >> >> CamelDataFormat camelDataFormat = new >> CamelDataFormat("org.apache.camel.bindy.model"); >> >> @Bean >> public RouteBuilder route() { >> return new RouteBuilder() { >> public void configure() { >> from("direct:start") >> //from("file://src/test/data/") >> .unmarshal(camelDataFormat) >> .to("mock:result"); >> } >> }; >> } >> } >> >> } >> >> question : Why testMarshallMessage is not executed ? >> >> >> >> >> ----- >> Charles Moulliard >> SOA Architect >> >> My Blog : http://cmoulliard.blogspot.com/ >> http://cmoulliard.blogspot.com/ >> -- >> View this message in context: >> http://www.nabble.com/only-testMocksAreValid-is-executed-by-Camel-Spring-unit-test-%21%21-tp21436628s22882p21436628.html >> Sent from the Camel - Users mailing list archive at Nabble.com. >> >> > > > > -- > James > ------- > http://macstrac.blogspot.com/ > > Open Source Integration > http://fusesource.com/ > > ----- Charles Moulliard SOA Architect My Blog : http://cmoulliard.blogspot.com/ http://cmoulliard.blogspot.com/ -- View this message in context: http://www.nabble.com/only-testMocksAreValid-is-executed-by-Camel-Spring-unit-test-%21%21-tp21436628s22882p21437124.html Sent from the Camel - Users mailing list archive at Nabble.com.