Tags » JUnit

Rule Them All meets PhantomJS to test JAX-RS javascript client generation

HTMLUnit is great to test web applications but sadly it doesn’t support recent js libraries (AngularJs/JQuery to not say their names).

PhantomJs is a great alternative but sometimes setup can be boring or too complicated for what you need. 903 more words

JavaEE

When my test is a feature!

I came across a situation where I have to write a unit test, but the test as such is a feature. Well, not really, the test will be production code but used by the consumers as part of the acceptance test.   238 more words

Eclipse

Some thoughts on JUnit Test with Mockito

In the past a few days I’ve worked on writing unit tests for a service. It was a completely different experience. The unit tests I wrote before were very simple ones with several assertions and that’s it. 423 more words

Java

How to run a JUnit test multiple times

I had a Spring-enabled JUnit test that I needed to run multiple times. I thought there used to be a JUnit annotation, but I couldn’t find it. 418 more words

Spring

Random Java objects for testing

As a Java developer you should test the code you’re writing. In a perfect world every line of code should be covered by a test scenario. 1,444 more words

Programming

JUnit's ExpectedException @Rule

Some time ago I had written a post about different ways to deal with exceptions using JUnit. It’s time to augment that post with a truly great way to achieve the same result. 766 more words

TDD

JUnit 4 - parameterised test example

The class under test:

public class Solution {
  static final int base = 10;
  final static String convertToBase (long number, int base){
     String stringValue = Long.toString(number,base);
     return stringValue;
  }
} 139 more words
Software-development