Java 02: Clean Test Java
Unit Test practical course for programmers

You want to write structured and high-quality unit tests for your Java code? You want to test databases, foreign APIs and foreign code? You want to recognize bad and useless unit tests right away and turn them into good unit tests using proven patterns? You finally want to know how Test-Driven-Development looks like in practice and how you can use TDD in a reasonable way? Then look no further. This Java Unit Testing practical seminar is ideal for all Java programmers who want to learn JUnit 5, Mockito and MockPower in an efficient and practical way by means of clear examples and tasks in order to be able to test Java code cleanly and improve it considerably. Learn more about this Unit Test practical seminar..

Benefits

  • Quick and effective introduction to JUnit 5 and Mockito
  • Practical introduction to Test-Driven Development (TDD)
  • Best practices for Testable Design, Clean Test and Test Smell
  • Advanced techniques such as Test Double
  • Significantly improve code quality through good testing

By means of many examples and exercises you will learn the most important Java testing frameworks (JUnit 5 & Moskito) as well as advanced techniques such as TDD from a practical point of view and use them successfully in your current project. You will also learn and apply the golden rules for clean testing and code. You will improve the quality and qoodness of your Java production code and thus shorten the development time.

Course formats

1-DAY CRASH COURSE

Live-Training

Live oder online large

Teaching material

Lehrmaterial

Video-Clips

Video clips
3-DAY INTENSIVE COURSE

Live-Training

Live oder online large

Teaching material

Lehrmaterial

Catering

Snacks large
4-WEEK TRAINING PROGRAM

Live-Training

Online large

Teaching material

Lehrmaterial

Video-Clips

Video clips

All courses also include unlimited access to our member area with many more videos, tutorials and information about coding.

Contents

The course covers a selection of the following topics:

  • Test Structure
  • Name Conversion
  • Test Lifecycle
  • Test Data
  • Annotations
  • Assertions
  • Parameterized Test
  • Test Double
  • Mockito Framework
  • PowerMock Framework
  • Test Driven Development
  • Test Smells Catalog
  • Test Readability
  • Test Maintainability
  • Test Trustworthiness

For more details please see the agenda below.

Prerequisites

The JUnit 5, TDD and Mockito seminar at the Munich Coding Academy is aimed at programmers with basic Java knowledge. It does not require knowledge of old JUnit versions.

  • Individuell: wir gehen gezielt auf Dich ein und berücksichtigen Deine Vorkenntnisse, Wunschthemen und Schwerpunkte

  • Strukturiert und leicht verständlich

  • Bringe deine Karriere, Studium oder Ausbildung auf die nächste Stufe: mit Zertifikat

  • Sicher und eigenständig Programme entwickeln (ob privat, beruflich oder für dein Startup)

  • Viel, viel, viel Praxis: sofort anwendbare Ergebnisse

  • kleine Gruppen: max. 8 Teilnehmer im 3-Tages-Kurs max. 15 Teilnehmer im Online-Coaching

  • Von Experten nach der Raed- Methode® entwickelt & auf die Anforderungen von Tech-Unternehmen im Jahr 2020 ausgerichtet

  • E-Mail-Support auch nach Ende des Kurses

Description

The Unit 5 with Mockito training at the Coding Akademie Munich is scheduled for 3 days and is perfect for all Java programmers who want to test their own or third-party Java code. With unit tests you can check whether your code does exactly what is expected of it. Experience shows that unit tests increase the quality of programming code. This is because writing tests requires a close look at the production code. Often you discover errors (bugs) and come up with better solutions. This Unit Testing course is about mastering the basics of JUnit 5 , Mockito, PowerMock and Test-Driven-Development with the help of many examples and tasks, so that you can use these techniques immediately. Mastering the basics of JUnit 5 , Mockito, PowerMock and Test-Driven-Development with the help of many examples and tasks, so that you can use these techniques immediately.

With JUnit 5 you can test your production code quickly and easily. The principle is relatively simple, it is about the question: what do I expect from my method and what does it deliver exactly, i.e. a target/actual comparison of the values. JUnit 5 is the successor to JUnit 4. It is a testing framework that also helps you to easily test new language concepts such as lambda expressions in Java - as of JUnit 5, test methods are even allowed to have parameters. With Mockito you can test APIs code, database (CRUD operations) and client/server applications by imitating and simulating the behaviour of such code locally.

What do you learn on the first day?

You learn how to write your first unit testing programme. We start slowly and look at the should/actual principle of testing frameworks. You learn how the test structure should look like, how you should name your test methods and how you can find the test data. The equivalence classes and boundary value techniques are suitable for this. You master the syntax and semantics of unit tests such as annotations and assertion. You will also learn and master advanced techniques such as parameterised tests on the first day. After this day, you will already be able to write and apply unit tests for your Java code.

What do you learn on the second day?

On the second day, you learn how to test database and third-party APIs by simulating their code. This is what the Test Double technique is for. Test Double is a collective term for 5 techniques: Dummy, Fake, Stub, Spy and Mock. Since it is quite time-consuming and sometimes difficult to implement such test double techniques from scratch, there are already frameworks that largely realise and simplify these techniques. One of them is Mockito and PowerMocks. You will learn how to set up and run Mockito and PowerMock. For this we look at an order system program written in Java EE or Java Spring. With Mockito and PowerMock we test the ordering process and the basic CRUD database operations (Create, Read, Update, Delete) that are common in such a system.

With JUnit 5, Mockito and PowerMock's basics you will already be able to write extensive tests for your Java code after the second day. You will even notice that this unit test writing, which is seen as a tedious afterthought by many programmers, is not such a chore after all and is even fun and enjoyable when you run the test and suddenly everything is green. It is a nice and pleasant feeling to experience!

What do you learn on the third day?

The last Unit Testing training with Java is about how to write good tests. Here you will learn the SOLID principles for testable design. Then we look at the Test-Driven-Development (TDD) technique. TDD implements the "Test First: Test code before Production code" method. TDD slows down the development speed at the beginning, but later on it catches up massively in speed and is definitely more advantageous than writing the tests afterwards. After all, Clean Code is largely based on writing unit tests before production code, so you have to think about the production code in a fundamental way! You will also learn the important rules for writing meaningful and good tests and the best practices. This will help you recognise the so-called "test smells". Test smells is a term for bad tests that bring more disadvantages than advantages. There is a long catalogue for this, which divides the test smells into 3 categories and in each category there are several test smells cases. We look at the most important test smells cases.

YOUR TRAINERS

The Unit Test course for Java programmers is conducted by one of the following trainers:

CERTIFICATE

Of course, as a participant in the Java Unit Test course for programmers you will receive a certificate. The prerequisite for this is the complete participation in all course units and programming tasks and the successful programming of a small final project. However, after this intensive unit testing course, this will be more fun than stressful for you.

AGENDA

The agenda is written in English due to the numerous technical terms. Descriptions and course material are in German. You can book the course either in German or English.

All seminar contents are individually adapted to the wishes of our participants. They can vary depending on the level of knowledge and will be defined together with the seminar leader on day 1. In this Java unit test seminar you can choose from the following topics:

Java Unit Testing for Programmers Day 1

Introduction:

  • Test Motivation
  • Test Frameworks
  • JUnit 4 and JUnit 5
  • JUnit 5 vs. JUnit 4
  • Testing Questions

Generic Rules:

  • Test Structure
  • Test Life Cyce
  • The AAA-Rule
  • Name Conversions
  • Test Data
  • Happy Path
  • Exception Path
  • Equivalence classes
  • Test Strategy

Annotation

  • @Test
  • @BeforeEach
  • @AfterEach
  • @BeforeAll
  • @AfterAll
  • @Disabled
  • @DisplayName
  • @Nested
  • @RepeatedTest
  • @Tag
  • ..

Assertions

  • fail
  • assertTrue
  • assertFalse
  • assertNull
  • assertNotNull
  • assertEquals
  • assertNotEquals
  • assertArrayEquals
  • assertAll
  • assertThrow
  • assertTimeout
  • assertIterableEquals
  • assertLinesMatch
  • Functional Interface
  • ...

Parameterized Test

  • Configuration
  • @ValueSource
  • @EnumSource
  • @MethodSource
  • @CsvSource
  • @CsvFileSource
  • @ArgumentSource
  • ..

Java Unit Testing for Programmers Day 2

Test Double

  • Motivation
  • Testing Database?
  • Dummy
  • Fake
  • Stub
  • Spy
  • Mock

Mockito Basic

  • Maven or Gradle
  • Spring Example
  • System Under Test SUT
  • Mockito Idee
  • Mockito Annotations
  • @Mocks
  • @InjectMocks
  • @Spy
  • when then Return
  • doReturn when
  • when thenThrow
  • when thenAnswer
  • doNothing when
  • given withReturn
  • given willThrow
  • given willAnswer
  • verify
  • Mockito Steps
  • Stubbing
  • Setting Expectations
  • Verify

Mockito Advanced

  • Hamcrest Matcher
  • @RunWith
  • @Captor
  • Mockito Spy
  • Mockito Restriction
  • Final and Private Methods?

Powermock

  • Setting up PowerMock
  • Mocking Static Method
  • Invoking Private Method
  • Mocking a Constructor

Unit Testing with Java Day 3

Test Driven Development

  • Motivation
  • RED
  • GREEN
  • REFACTORING
  • Baby Steps
  • TDD Advantages

Testable Design

  • SOLID Principle
  • Single Responsibility
  • Open Close
  • Liskov Substitution
  • Interface Segregation
  • Dependency Inversion

Clean Test

  • Clean Test Rules
  • Test Readability
  • Test Maintainability
  • Test Trustworthiness
  • Test Smells Catalog

Course formats / dates

1 Day Crash Course

In München oder Online

3 Days Course

In München oder Online

4-Wochen-Training

€1,876.00
Participation possible at any time

4-Wochen-Training copy

€899.00
Participation possible at any time

For teams

Are you interested in a course for your team? Get in touch - we will find a perfect solution. Our professionals are also happy to come to you. Among other things, we offer:

  • In-house training
  • Technical coaching
  • Consulting
Request Request

Questions & Service

Our service team will be happy to advise you personally. Mon-Fri from 9.00 to 18.00 under:
+49 89 17958-820
info@coding-academy.com

References

BMW Apple Draeger VW Sky Siemens 2000px TÜ V Süd Logo Agfa Kopie Samsung Fraunhofer Valtech Deutsche Bank
Course Catalogue Overview of rocket courses: