Hello there,
I am trying to use the HttpClient library (in order to call the Facebook API's REST end points) to obtain a session key and verify user...
My code is here:
RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations =
{ "classpath*:**/*applicationContext-test.xml" })
public class FacebookUserTest
{
final St...
Hi all,
I have implemented a RMI Server and now I wanted to test if the method to start and stop this server are correcly implemented, using a JUnit test.
Here is the (simplified) code of my RMI server:
public void startServer() {
try {
...
registry = LocateRegistry.createRegistry(serverPort);
registry.rebi...
Is it possible to test for multiple exceptions in a single JUnit unit test? I know for a single exception one can use, for example
@Test(expected=IllegalStateException.class)
Now, if I want to test for another exception (say, NullPointerException), can this be done in the same annotation, a different annotation or do I need to wr...
I'm trying to run the sample tests that come with junit4.7 and having some difficulty.
java is respecting my CLASSPATH:
me@dinosaurhunter ~/Desktop> export CLASSPATH=
me@dinosaurhunter ~/Desktop> echo $CLASSPATH
me@dinosaurhunter ~/Desktop> java junit.textui.TestRunner junit.samples.AllTests
Exception in thread "main" java.lang.NoClas...
I am attempting to write some test cases for some classes that involve testing the equality of two dimensional arrays of data. Here is my first stab at it:
double[][] expected = {
{0, 104, 0},
{145.5, 0, 0},
{83, 0, 0}
};
double[][] actual = someObject.getArray();
Now, I see that JUnit does not have an 'array...
I have the classical structure for tests, I have a test suite of different suites like DatabaseTests, UnitTests etc. Sometimes those suites contains other suites like SlowDatabaseTests, FastDatabaseTests etc.
What I want is to randomize the running order of tests so I will make sure they are not dependent to each other. Randomization s...
I have a test class, written in JUnit4 syntax, that can be run in eclipse with the "run as junit test" option without failing. When I run the same test via an ant target I get this error:
java.lang.Exception: Test class should have public zero-argument constructor
at org.junit.internal.runners.MethodValidator.validateNoArgConstructor(Me...
I have a class that I made for some unit tests. Everything was going swimmingly until I changed the name of the class to match the class that I was testing suffixed with TestCase. All of a sudden every time I tried to run the test case in Eclipse I get a "There is no input configuration for this type".
Someone then suggested that there ...
I wrote the test case for junit3.
In eclipse test runner there are Junit 3 and Junit4.
If I use junit 4 I can not run each individual testmethod. So I want to use only Junit 3.
I removed the junit4 plugin from eclipse/plugin. Still I am seeing the Junit4 tag in the test runner option.
How can I remove Junit4 from my test runner opt...
I am writing a Java multi-threaded network application and having real difficulty coming up with a way to unit test the object which sends and receives communication from network clients.
The object sends out a message to a number of clients and then waits for responses from the clients.
As each client responds, a dashboard-style GUI i...
I have three hierarchical layers injected in Spring - rest, business logic and database operations. Junit tests for BL and DAO are working OK, when rest can inject only business logic ioc layer.
My supper class for junit tests:
import org.springframework.test.AbstractTransactionalSpringContextTests;
public class AbstractTest extends A...
I have maven configured to run gunit (an ANTLR grammar unit testing tool) through the maven-gunit-plugin. gunit, however, has two different modes. The first mode causes gunit to act as an interpreter, reading through the *.gunit (or *.testsuite) file, interpreting it, and displaying the results. It can be configured as such:
<plugi...
I'm looking for a way to apply TDD to Session Beans.
can anyone provide advices and links on how to unit test them ?
how to use JUnit to do so ?
P.S : I'm new to Test Driven Development and Session Beans.
I'm using EJB v2.
...
Like the title says, I'm looking for some simple way to run JUnit 4.x tests several times in a row automatically using Eclipse.
An example would be running the same test 10 times in a row and reporting back the result.
We already have a complex way of doing this but I'm looking for a simple way of doing it so that I can be sorta sure t...
How do I run a Eclipse JUnit plug-in test in a non-ui thread when running the tests from the command-line? In the launch configuration dialog I can uncheck the checkbox "Run in UI thread", but how do I do that when running plug-in tests on the command-line?
EDIT: It seems as if org.eclipse.pde.junit.runtime.nonuithreadtestapplication is...
I am writing a web application which should be tested with JUnit framework. So please suggest me how we can use JUnit in Jsp and servlet and also how to generate test case reports using Ant?? Thanks in advance
Why cant we use Cactus? I have heard about that and what it differs from other test cases?
...
I have a problem executing unit tests in Eclipse behind a proxy, as the classes used by the unit tests call some web services, which are behind a proxy. In Tomcat I can of course specify a proxy to be used, but when I run unit tests directly from Eclipse, the proxy configuration of Eclipse seems to be ignored. How can I configure my unit...
I'm trying to unit test a class with a number of private methods. Each of the private methods can be rather extensive.
I can either make the method package scoped (which causes a warning), or I can use the code below to test it:
Method method = instance.getClass().getDeclaredMethod("methodName");
method.setAccessible(true);
Object obje...
Below is a test I have knocked up that uses its own matcher. I know in this case I could use a standard matcher but in my real code I need a more complicated one.
The test passes - tick VG.
The issue is that there appears to be an extra call to IArgumentMatcher.matches() method that returns false, and yet the test passes.
The output I ...
This question is similar to a previous one. I am trying to @Autowire a Hibernate Session in one of my Spring-JUnit-Transactional tests but I am getting this exception:
java.lang.IllegalStateException: No Hibernate Session bound to thread, and configuration does not allow creation of non-transactional ...
Here is my JUnit class:
@RunWi...