RSSAmplifier

Tim Zöller · Aug 15, 2024

Unit testing with LocalDateTime.now() in Java

0
Sign in to vote or save

This site does not allow itself to be embedded. You can still read it on the original site — the toolbar below keeps your place in the directory.

When writing unit tests, we expect the classes under test to be in a certain state that we can set up in our test. A dynamic state, which is initialised in the class itself, makes our unit testing life much harder. In this short post I will share my approach to make classes using LocalDateTime.now() more testable in a Spring Boot application.

Read on javahippie.net

Comments

Nothing yet. Say the first thing.

    Sign in to join the conversation.