Given the following example (using JUnit with Hamcrest matchers)
Map<String, Class<? extends Serializable>> expected = null;
Map<String, Class<java.util.Date>> result = null;
assertThat(result, is(expected));
This does not compile with the JUnit AssertThat method signature of:
public static <T> void assertThat(T actual, M...
I have a JAX-RS web service implemented with Restlet library and now I want to test it. In order to do that I'd like to host this service in my test by preinitializing it with mocked services.
What is the best way to host such a service and execute the test calls?
@Path("/srv")
public class MyService
{
@GET
public void action(@Co...
I have a JAX-RS web service implemented with Jersey library and now I want to test it. In order to do that I'd like to host this service in my test by preinitializing it with mocked services.
What is the best way to host such a service and execute the test calls?
@Path("/srv")
public class MyService
{
@GET
public void action(@Con...
I'm familiar with the use of Parameterized tests in JUnit, e.g:
http://junit.org/apidocs/org/junit/runners/Parameterized.html
but I wondered whether there were any alternative (possibly better) approaches to externally defined test data. I don't really want to hardcode my test data in my source file - I'd prefer to define it in XML or...
I want to create a launcher/run configuration which runs only the JUnit tests in a selected set of test classes or selected set of packages. Now it looks like I'll have to create separate run configurations for each of my packages containing the tests I want to run. I also have a recollection of this working in older versions of Eclipse....
I'm developing in Java and using JUnit to test some of my methods. Some of my methods send emails. The emails are actually sent by a separate thread that is spawned. The problem is that whenever I test these methods everything goes fine except that the emails are not actually sent. I've followed the execution through the whole stack and ...
Hi all,
While using DragAndDrop function on a splitter control what I see is first it
gets stuck most of the times. Also when I give the offset as +70 it moves to
the position which is 70 units away from the start of the screen. What I
understand is that it should move 70 units away from where it is now.
Any idea why this is not workin...
I am running JUnit tests using in memory HSQLDB. Let's say I have a method that inserts some values to the DB and I am checking if the method inserted the values correctly. Note that order of the insertion is not important.
@Test
public void should_insert_correctly() {
MyEntity[] expectedEntities = new MyEntity[2];
// init expec...
where do i start on writing plugin test? I have written some toy plugins and would like to start on doing TDD with my plugins.
...
I've found a solution, see my own answer below. Does anyone have a more elegant one?
Assume the following class to be tested:
public class Foo {
private final Logger logger = LoggerFactory.getLogger(Foo.class);
public void bar() {
String param=[..];
if(logger.isInfoEnabled()) logger.info("A message with paramete...
I have found out that for java automation testing better approach would be to use Cruise Control(java), JUNIT (java testing framework) along with Watij. Any further suggestions please. Any one who has succesfully integrated these tools and what limitations are found for this.
regards
...
I would like some suggestions if your project has some java application elements as well as web then is there an option for testing java applications from the outside like we do with the web applications
...
Hi, I'm creating a test platform for a protocol project based on Apache MINA. In MINA when you receive packets the messageReceived() method gets an Object. Ideally I'd like to use a JUnit method assertClass(), however it doesn't exist. I'm playing around trying to work out what is the closest I can get. I'm trying to find something simil...
I am configuring JUnit in Ant so that unit tests will be run on each build. I would like the output of failing tests to be printed in the Ant console output whenever they are run. I don't need to see any output from succeeding tests.
Here is the relevant bit of my build.xml file:
<junit>
<classpath>
<pathelement path="${bui...
I'm using Ganymede on Ubuntu Linux and I have junit-4.3.1.jar in my build path. I click File > New > Java > "JUnit 4 Test Case" when I create a new test, but when it's run, Eclipse appears to be using JUnit 3. I believe this is the case because it's ignoring my annotations.
When I remove all test* methods, JUnit complains "No tests fo...
Hey guys,
I think I am not the only one who is gonna ask this question next time.
After some experience with RoR I am impressed with the power of dynamic languages. Lots of projects are still forced for different reasons to use a java technology stack though. Since testing is an important part of any project I would like to hear your e...
I'm trying to find a practical unit testing framework for JSF.
I know about JSFUnit, but this is very impractical to me. I need to include about 10 JARs to my project, and jump through many other hoops just to get it running.
I realize that -- due to the need to simulate a platform and a client -- unit testing web applications is diff...
I am trying to get RPC testing using GWT. I am using the default StockWatcher project that is mentioned here, I download the project, I import it, everything works fine.
I then run junitcreator in the StockWatcher project:
/Users/stephen/Work/gwt/gwt-mac-1.6.4/junitCreator -junit /Users/stephen/Applications/eclipse/plugins/org.junit_...
I have a A few base test classes that setup common configurations for spring,logging,jndi etc using test execution listeners that are then inherited by subclasses. This is done so tests can just run code without having to worry about getting jndi and logging services in place before being able to run testing code.
Using intellij and inv...
I am trying to detect a midair collision problem (simultaneous editin) using selenium.
So I start a selenium session A with following (Super Class)
selenium = new MASSelenium(serverHost, serverPort, *iexplore, browserURL);
selenium.start();
selenium.open("index.cgi");
then I try starting a different selenium session B pointing to a d...