Running on Java 21-ea+14-1161 (Preview)
Home of The JavaSpecialists' Newsletter

1.12 WordLibraryTest With JUnit

Juppies 2 by Dr Heinz M. Kabutz

We see our first unit test, written with a framework called JUnit. The test method is annotated with @Test, telling JUnit to run this method during the test. Annotations are used a lot, especially when we start using Spring or Java EE. They are meta-information to guide our frameworks on which magic incantations to perform.

We also have a setup() method with an annotation @Before. This is called before our tests are run.

We will test all the words in the word library, to see whether the letters all match.


When you load these comments, you'll be connected to Disqus. Privacy Statement.

Table of Contents

We hope you enjoyed this tutorial. If you did, you will also enjoy our courses. We suggest you start with Extreme Java - Advanced Java, followed by Extreme Java - Concurrency Performance for Java 8.

About the Author

Heinz Kabutz Java Conference Speaker

Java Champion, author of the Javaspecialists Newsletter, conference speaking regular... About Heinz

Superpack '23

Superpack '23 Our entire Java Specialists Training in one huge bundle more...

Free Java Book

Dynamic Proxies in Java Book
Java Training

We deliver relevant courses, by top Java developers to produce more resourceful and efficient programmers within their organisations.

Java Consulting

We can help make your Java application run faster and trouble-shoot concurrency and performance bugs...

Java Emergency?

If your system is down, we will review it for 15 minutes and give you our findings for just 1 € without any obligation.