How to run simple dbunit test (problems with slf4j) -
i'm trying set simple dbunit test app, facing next problem:
1) i'm not sure steps should perform run dbunit, while junit quite easy (@before, @test, @after) 2) i've extended databasetestcase , overriden 2 methods here:
@override protected idatabaseconnection getconnection() throws exception { class.forname("com.mysql.jdbc.driver"); connection jdbcconnection = drivermanager.getconnection("jdbc:mysql://localhost/bank","root","root"); homecoming new databaseconnection(jdbcconnection); } @override protected idataset getdataset() throws exception { file branchxmlfile = new file("src/task10/dbunit/something/branch.xml"); if(branchxmlfile.exists()) system.out.println("fileexists"); homecoming new flatxmldatasetbuilder().build(new fileinputstream(branchxmlfile)); } @test public void testsomething(){ fail(); }
however, stub-realization fails terrible stack-trace referencing slf4j
exception in thread "main" java.lang.noclassdeffounderror: org/slf4j/loggerfactory @ org.dbunit.databasetestcase.<clinit>(databasetestcase.java:51) caused by: java.lang.classnotfoundexception: org.slf4j.loggerfactory @ java.net.urlclassloader$1.run(unknown source) @ java.net.urlclassloader$1.run(unknown source) @ java.security.accesscontroller.doprivileged(native method) @ java.net.urlclassloader.findclass(unknown source) @ java.lang.classloader.loadclass(unknown source) @ sun.misc.launcher$appclassloader.loadclass(unknown source) @ java.lang.classloader.loadclass(unknown source) ... 1 more
i can't why need slf4j if i'm using log4j?
so help me prepare problem , perchance provide little illustration of testing using dbunit? (yes, i've seen documentation , i'm trying run illustration doesn't work)
slf4j dbunit
No comments:
Post a Comment