IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Spring Java Discussion :

Problème à partir mon JUnit


Sujet :

Spring Java

  1. #1
    Membre régulier
    Inscrit en
    Mai 2002
    Messages
    219
    Détails du profil
    Informations forums :
    Inscription : Mai 2002
    Messages : 219
    Points : 74
    Points
    74
    Par défaut Problème à partir mon JUnit
    bonjour a tous voici mon code
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
     
    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();
            }
        }
     
    }
    Deja , j'ai une erreur niveau du package
    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)

    je pense bien avoir un genre de conflit. Endirait qu'il trouve pas ApplicationContextInitializer pour mettre mon DispatcherServlet
    voici mon pom
    <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>
    pour une version 4.4 de junit
    puis-je avoir de l'aide svp pour savoir ce qui se passe merci

  2. #2
    Membre régulier
    Inscrit en
    Mai 2002
    Messages
    219
    Détails du profil
    Informations forums :
    Inscription : Mai 2002
    Messages : 219
    Points : 74
    Points
    74
    Par défaut RESOLU
    tout est beau, c'etait un mauvais problème. Juste que ressource n'est pas donc mon classPath.

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. problème sur mon ordi
    Par loveflower dans le forum Sécurité
    Réponses: 6
    Dernier message: 29/11/2005, 16h18
  2. [MySQL] Problème dans mon script de pagination
    Par speedylol dans le forum PHP & Base de données
    Réponses: 3
    Dernier message: 03/11/2005, 19h37
  3. Problème avec mon service mysql et PhpMyAdmin
    Par Fixazo dans le forum Outils
    Réponses: 1
    Dernier message: 28/08/2005, 18h02
  4. problème avec mon lecteur CD
    Par leo13 dans le forum Périphériques
    Réponses: 3
    Dernier message: 16/08/2005, 11h21
  5. Problème avec mon firewall ...
    Par Wis dans le forum Tomcat et TomEE
    Réponses: 15
    Dernier message: 06/04/2004, 08h46

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo