August 2017
Intermediate to advanced
142 pages
3h
English
© Jorge Acetozi 2017
Jorge Acetozi, Pro Java Clustering and Scalability, https://doi.org/10.1007/978-1-4842-2985-9_24
Jorge Acetozi1
(1)São Paulo / SP, Brazil
Unit tests provide fast feedback, but they test only an isolated unit of code (a method in a class, for example). In the chat application, I write unit tests using JUnit1 along with Mockito2 and Hamcrest.3
The InstantMessageBuilderTest.java class tests the InstantMessageBuilder class, which implements a builder pattern4 to provide a chain of methods responsible for simplifying the creation of a new InstantMessage object.
public class InstantMessageBuilderTest { private final String chatRoomId = "123"; private final String fromUser = "jorge_acetozi"; ...Read now
Unlock full access