Grokking Spring Boot
0% completed
Unit Tests Without Spring
FakePaymentClient payments = new FakePaymentClient(); Clock clock = Clock.fixed(NOW, ZoneOffset.UTC); BookingService service = new BookingService(seats, bookings, customers, payments, clock);
These three lines build the object that a test of the booking service checks. No container starts, no port opens, and no database exists. The test class that begins this way ran four tests in our build, and after the first one, each test finished in 5 to 36 milliseconds.
A Spring application is still made of ordinary Java classes, so much of it can be tested with ordinary Java
.....
.....
.....
Like the course? Get enrolled and start learning!
Reading Progress
0%