dcsimg
problem with my junit
0 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Morisseau_Emmanuel
Posted On:   Thursday, June 26, 2014 10:30 AM

Hi everyone , here is my code [code=java] package ractifs;     import java.util.Locale;   import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse;   import junit.framework.TestCase;   import org.junit.Before; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.TestContext; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import org.springframework.test.context.web.WebAppConfiguration;    More>>

Hi everyone , here is my code
[code=java]

package ractifs;
 
 
import java.util.Locale;
 
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
 
import junit.framework.TestCase;
 
import org.junit.Before;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.TestContext;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.test.context.web.WebAppConfiguration;
 
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = {"classpath:lel-servlet.xml", "classpath:lel-servlet.xml"})
@WebAppConfiguration
public class ctifsTest extends TestCase
{
 
    @Autowired
    private TickerCache tickerCache;
 
    private Form form;
 
    Locale locale;
    HttpServletRequest request;
    HttpServletResponse response;
 
 
    @Before
    public void setUp() throws Exception
    {
        form = new Form();
 
        // modele = new Model();
        locale = new Locale("fr", "CA");
 
        // request = new HttpServletRequest();
        // response = new HttpServletResponse();
    }
 
 
 
 
 
    public void testTest() throws Exception
    {
        try
        {
 
            ctifs controller = new ctifs();
            tickerCache = tickerCache;
            // ModelAndView modelAndView = controller. .handleRequest(null,
            // null);
            String test = controller.jeu(form, null, locale, null, "demo", "BmonJeton", null);
        }
        catch (Exception e)
        {
            e.printStackTrace();
        }
    }
 
}
[/code]

I have a packages

[quote]
Description Resource Path Location Type
The project was not built since its build path is incomplete. Cannot find the class file for org.springframework.context.ApplicationContextInitializer. Fix the build path then try building this projec Unknown Java Problem
Description Resource Path Location Type
The type org.springframework.context.ApplicationContextInitializer cannot be resolved. It is indirectly referenced from required .class files ctifsTest .java jeu line 1 Java Problem
et quand je lance le junit j ai un
java.lang.NoSuchFieldError: NULL
at org.junit.runners.ParentRunner.<init>(ParentRunner.java:54)
at org.junit.runners.BlockJUnit4ClassRunner.<init>(BlockJUnit4ClassRunner.java:55)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.<init>(SpringJUnit4ClassRunner.java:104)
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:513)
at org.junit.internal.requests.ClassRequest.buildRunner(ClassRequest.java:33)
at org.junit.internal.requests.ClassRequest.getRunner(ClassRequest.java:28)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.<init>(JUnit4TestReference.java:33)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestClassReference.<init>(JUnit4TestClassReference.java:25)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.createTest(JUnit4TestLoader.java:48)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.loadTests(JUnit4TestLoader.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:452)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)

 [/quote]

I think well of having a conflict.
It can not find my ApplicationContextInitializer for the DispatcherServlet

my pom[code=java]
<dependency>
     <groupId>org.jmock</groupId>
     <artifactId>jmock-junit4</artifactId>
     <version>2.6.0</version>
</dependency>

<dependency>
     <groupId>org.springframework</groupId>
     <artifactId>spring-test</artifactId>
    <version>3.2.3.RELEASE</version>
    <scope>test</scope>
</dependency>

<dependency>
    <groupId>junit</groupId>
    <artifactId>junit</artifactId>
   <scope>test</scope>
</dependency>
[/code]
I use junit 4.4
Can some one help me please
 

   <<Less
About | Sitemap | Contact