List/Grid Tag Archives: JUnit

apache-maven-logo

HOW-TO: Test dependencies in a Maven project (JUnit, Mockito, Hamcrest, AssertJ)

JUnit itself is not enough for most of today’s Java projects. You also need a mocking library, maybe something else. In this mini HOW-TO I present the test dependencies you can ...
junit-logo

Testing for expected exceptions in JUnit

Unit tests are used to verify that a piece of code operates as the developer expects it to. Sometimes, that means checking that the code throws expected exceptions too. JUnit is the ...
junit-logo

Access private fields in unit tests

First of all, let me say out louder, you need to design your code to be testable, so you test your private fields through your public methods. But, (“buts” are the reasons ...
junit-logo

More Units with MoreUnit

Just over a year ago I wrote a post about working with JUnit in Eclipse. One of the commenters recommended MoreUnit in order to increase testing efficiency even more. Giving it a try ...
junit-logo

Introduction To JUnit Theories

Have you ever read a mathematical theory? It typically reads something like this: For all a, b > 0  the following is true: a+b > a and a+b > b Just typically the statements ...
junit-logo

Parameterized JUnit tests with JUnitParams

Parameterized unit tests are used to to test the same code under different conditions. Thanks to parameterized unit tests we can set up a test method that retrieves data from some data ...
junit-logo

Run, JUnit! Run!!!

JUnit together with JavaScript and SVN are some of the technologies that programmers often start using without even reading a single blog post let alone a book.  Maybe this is ...
jboss-drools-logo

JBoss Drools unit testing with junit-drools

Recently I’ve been working with a project heavily using JBoss Drools. I am not Drools expert – I am not also very convinced to this framework, or maybe only to particular use case ...
junit-logo

A JUnit Rule to Conditionally Ignore Tests

I always believed that using @Ignore to deactivate tests is a bad idea. Except, maybe as one way to put tests that fail intermittently into quarantine to attend to them later (as Martin ...
junit-logo

3 ways of handling exceptions in JUnit. Which one to choose?

In JUnit there are 3 popular ways of handling exceptions in your test code:try-catch idiom With JUnit rule With annotationWhich one should we use and when?try-catch idiom This ...
Java Code Geeks and all content copyright © 2010-2014, Exelixis Media Ltd | Terms of Use | Privacy Policy
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.
Java Code Geeks is not connected to Oracle Corporation and is not sponsored by Oracle Corporation.

Sign up for our Newsletter

20,709 insiders are already enjoying weekly updates and complimentary whitepapers! 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.

As an extra bonus, by joining you will get our brand new e-books, published by Java Code Geeks and their JCG partners for your reading pleasure! Enter your info and stay on top of things,

  • Fresh trends
  • Cases and examples
  • Research and insights
  • Two complimentary e-books