Hi all,
I've got a JUnit-test which is successfull when starting with mvn test but fails when starting from Eclipse (see stack trace below). What I'm trying to do is inserting new elements into the database with entityManager.persist() and entityManager.flush() (when calling flush, I get the error).
My config.properties looks the follo...
I'm working on a growing java project and I'm probably going to cooperate with somebody else to improve some features.
I'd like to use some tools to improve the quality of my work keeping in mind that:
I don't have too much time to spend on this project
it's a small project but it's really important for me
I don't want to buy software...
I am trying to debug a junit test in eclipse but my breakpoints are not firing (unless they are on the first or second line).
I've tried deleting and recreating all breakpoints in the workspace, cleaning the project, creating a new debug configuration, and running the test method individually and as part of a test class with other metho...
Eclipse is not suspending on an uncaught runtime exception during debugging of a Junit test. I've tried:
JRE 1.6 update 15 and 16
Eclipse 3.5.0 and Eclipse 3.4.2
Checked "Suspend on uncaught exception" for the exception and all runtime exceptions
Checked "Keep JUnit running after a test run when debugging"
Debugging when running only t...
(No "related questions" seem to nail this, so here goes.)
I work on production code. Arguing for anything that isn't visible to the user is hard to do, sometimes. If sales can't see it, it's an external cost to them, and they'll argue against it unless there's a great reason not to.
How much unit testing is a good thing? If you test...
What is an easy way to compare ArrayLists for equality using JUnit? Do I neeeeeed to implement the equality interface? Or is there a simple JUnit method that makes it easier?
...
I am trying to test an entity EJB3 with Spring.
The EJB itself does not uses Spring and I would like to keep duplications of the production JPA configuration minimal (ie not duplicating persistence.xml for exemple).
My unit tests seems to work but even though my unit tests should be transactionnal, data is persisted between the various...
If so, how? I haven't come across the proper incantation yet.
If not, what's the best approach to unit-testing Scala code from the command line? (I'm a troglodyte; I use IDEs when I have to, but I prefer to play around using Emacs and command-line tools.)
...
I am trying to use DBUnit with plain JDBC and HSQLDB, and can't quite get it to work -- even though I've used DBUnit with Hibernate earlier with great success. Here's the code:
import java.sql.PreparedStatement;
import org.dbunit.IDatabaseTester;
import org.dbunit.JdbcDatabaseTester;
import org.dbunit.dataset.IDataSet;
import org.dbuni...
I have some common set up code that I've factored out to a method marked with @Before. However, it is not necessary for all this code to run for every single test. Is there a way to mark it so the @Before method only runs before certain tests?
...
My setup:
Netbeans 6.7
Java6
JUnit 4.5 added as the Test libraries
When I try to pass in two class arrays (cast as Object[]) I get the error "cannot find symbol" and my test case will not compile.
I do not have an issue with the other assert statements, and as I said I am using the JUnit 4.5 libraries.
Does anyone have a clu...
I have JUnit tests that need to run in various different staging environments. Each of the environments have different login credentials or other aspects that are specific to that environment. My plan is to pass an environment variable into the VM to indicate which environment to use. Then use that var to read from a properties file.
Do...
Hi I have a question related to MockEJB. I need to write unit tests to test a code that is calling a EJB. I use Mockito to write a mock for the EJB, and MockEJB to simulate the JNDI context.
My tests look like this :
@Test
public void test1() throws Exception {
// create a mock instance
NetworkManager aMockManager = createMockNet...
Hello! I'm supposed to write unit tests for a project whose code another colleague has written. He created a generic list class. Now i'm thinking about, the best way to create the unittests for the class and how to avoid much repetitive code. The List class can be instaniated with String, Integer and some other Types. How can i avoid to ...
Hi,
I have created several files with unit tests on existing classes in NetBeans project.
I used menu "File/New file/JUnit/Test for Existing Class" to create test files.
I can run one file with unit tests by right click on it and select "Run File".
But I want to run all files with unit tests.
How can I achieve this in the simplest way...
I have a CruiseControl build server running a large number of projects. On one of them I have recently noticed that only one of the two test suites are present in the build report (but failures in the other one still cause the build to fail).
Further investigation showed that the XML output file of JUnit generated by ant's xmlformatter ...
I'm looking to unit test some SWT and Swing code for a project I'm working on and the tests run fine as long as I'm running them from eclipse.
As soon as I run them in my hudson environment it fails since hudson runs the tests in headless mode.
What's the best way of doing this? Open source solutions only please (since the project is ...
I'm trying to run Jettys ServletTester in my JUnit test. I created a simple HelloServlet first to test the setup, but I get an IllegalAccessException when I try to request the servlet. Here is what I have so far:
My unit test
@Before
public void setUp() throws Exception {
tester = new ServletTester();
tester.setContextPath("/co...
Hi, I'm currently working on a project which uses JUnit4 extensively throughout all the modules. We're using Maven2 to build the project and Hudson for continuous integration. The project is built and run under Java 1.5.
We've recently added quite a large raft of unit tests which are needed at times, but don't want to be run during the ...
I am working on a project that is using JDK 1.4 and I am planning to write JUnit test cases in JDK 1.5 for several reasons like:
I wanna explore JDK 1.5
to use Mocking frameworks more efficiently.
Is it a good idea to do so??
(I've created two projects in Eclipse and am trying this)
...