Tag Archives: JUnit

It was about time when the developer of Unit Tests had the ability to run the tests in Parallel using annotations. In today’s blog post, we will look at how you can make your traditional Junit Tests to run in parallel using annotations provided by Easytest. EasyTest is a Testing Framework build on top of JUnit to provide you ease ...

Your unit tests should be as descriptive as possible. The feedback they give you should be so clear you don’t even need to fire up the debugger and step one by one through the code to inspect your local variables. Why? Because that takes time and we’re lazy, right? In order to do so you need to create descriptive tests. ...

This time I want to make an overview of testing framework Mockito. Definitely this is one of the most popular tools for the testing of java code. I have already made the overview of the Mockito’s competitor – EasyMock. This post will be based on the sample application from the post about EasyMock. I mean classes which represent coffee machine ...

The time when our applications lived in isolation have passed long-long ago. Nowadays applications are a very complicated beasts talking to each other using myriads of APIs and protocols, storing data in traditional or NoSQL databases, sending messages and events over the wire … How often did you think about what will happen if, for example, a database goes down ...

Recently I came across a problem where I had to write tests for a method that calculates randomly distributed values within a certain range of possibilities 1. More precisely if you assume a signature that looks like interface RandomRangeValueCalculator { long calculateRangeValue( long center, long radius ); } a test might verify ...

A couple of years ago I wrote about JUnit Parameterized Tests. One of the things I didn’t like about them was that JUnit named the invidividual test cases using numbers, so if they failed you had no idea which test parameters caused the failure. The following Eclipse screenshot will show you what I mean: ...

Developers always need to take care about code which they produced. They should be ensured that code works properly after a new feature was implemented or some bug was fixed. That’s can be achieved at least with the help of unit tests. Since this blog is dedicated to Java programming language, today I will write the article about JUnit 4.1 ...

This post shows how to test for expected exceptions using JUnit. Let’s start with the following class that we wish to test: public class Person { private final String name; private final int age; /** * Creates a person with the specified name and age. * * @param name the name ...

When you are building a complex system, barely testing components in isolation is not enough. It’s crucial, but not enough. Imagine a car factory that manufactures and imports highest quality parts, but after assembling the vehicle never starts the engine. If your test case suite consists barely of unit tests, you can never be sure that the system as a ...

The Hamcrest 1.3 Javadoc documentation for the Matchers class adds more documentation for several of that class’s methods than were available in Hamcrest 1.2. For example, the four overloaded contains methods have more descriptive Javadoc documentation as shown in the two comparison screen snapshots shown next. Although one can figure out how the ...

Newsletter

Join them now to gain exclusive access to the latest news in the Java world, as well as insights about Android, Scala, Groovy and other related technologies.

Email address:

Recent Jobs

No job listings found.

Join Us

With 1,240,600 monthly unique visitors and over 500 authors we are placed among the top Java related sites around. Constantly being on the lookout for partners; we encourage you to join us. So If you have a blog with unique and interesting content then you should check out our JCG partners program. You can also be a guest writer for Java Code Geeks and hone your writing skills!

Disclaimer

All trademarks and registered trademarks appearing on Java Code Geeks are the property of their respective owners. Java is a trademark or registered trademark of Oracle Corporation in the United States and other countries. Examples Java Code Geeks is not connected to Oracle Corporation and is not sponsored by Oracle Corporation.