Issue
I use JUnit4 i added from the java buld path But still i have a error. I want to Complete the code to insert 3 books (ouvrage) in the catalog (Catalogue) And then Run your code using junit. I use JUnit4 i added from the java buld path But still i have a error. I want to Complete the code to insert 3 books (ouvrage) in the catalog (Catalogue) And then Run your code using junit. I use JUnit4 i added from the java buld path But still i have a error. I want to Complete the code to insert 3 books (ouvrage) in the catalog (Catalogue) And then Run your code using junit.
package fr.univrouen.bibliotheque.test;
//package fr.univrouen.bibliotheque.util;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import org.junit.Assert;
import org.junit.Test ;
import fr.univrouen.bibliotheque.*;
public class CatalogueTest {
Catalogue MonCatalogue = BibliothequeFactory.eINSTANCE.createCatalogue();
Ouvrage Ovr1 = BibliothequeFactory.eINSTANCE.createOuvrage();
Ouvrage Ovr3 = BibliothequeFactory.eINSTANCE.createOuvrage();
Ouvrage Ovr2 = BibliothequeFactory.eINSTANCE.createOuvrage();
@Test
public void Test() {
MonCatalogue.setNom("Biblio");
Ovr1.setAuteur("fouad");
Ovr1.setTitre("Tuto1");
Ovr1.setCategorie(Categorie.DOCUMENTAIRE);
Ovr2.setAuteur("david");
Ovr2.setTitre("Tuto2");
Ovr2.setCategorie(Categorie.DOCUMENTAIRE);
Ovr3.setAuteur("saad");
Ovr3.setTitre("Tuto3");
Ovr3.setCategorie(Categorie.DOCUMENTAIRE);
MonCatalogue.ajoutOuvrage(Ovr1);
MonCatalogue.ajoutOuvrage(Ovr2);
MonCatalogue.ajoutOuvrage(Ovr3);
assertEquals(0, 0);
}
}
I Have this ERROR
java.lang.NoClassDefFoundError: org/junit/runner/manipulation/Filter
at java.base/java.lang.Class.forName0(Native Method)
at java.base/java.lang.Class.forName(Class.java:315)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.loadTestLoaderClass(RemoteTestRunner.java:380)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.createRawTestLoader(RemoteTestRunner.java:370)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.createLoader(RemoteTestRunner.java:365)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.defaultInit(RemoteTestRunner.java:309)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.init(RemoteTestRunner.java:224)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:208)
Caused by: java.lang.ClassNotFoundException: org.junit.runner.manipulation.Filter
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:583)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
... 8 more
Solution
you can try adding @RunWith annotation to your class
@RunWith(MockitoJUnitRunner.class)
public class CatalogueTest {
...
Answered By - kraskixxx