Gradle Build Tool part 2

Installing Gradle Build Tool manually Until now, we let Idea handle all the gradle setup things, and maybe we should do this. Anyway, we should know that we can handle all these ourselves without the help from IDE’s. Note that to install Gradle we must have Java JDK pre-installed. Then go to this link: https://gradle.org/releases/…

Mockito Framework

Installing Mockito framework The Mockito framework can be downloaded at maven: https://repo1.maven.org/maven2/org/mockito/mockito-core/3.11.2/mockito-core-3.11.2.jar Because Mockito has three dependencies, we also download three other libraries. The Byte Buddy: https://repo1.maven.org/maven2/net/bytebuddy/byte-buddy/1.11.5/byte-buddy-1.11.5.jar The Byte Buddy Agent: https://repo1.maven.org/maven2/net/bytebuddy/byte-buddy-agent/1.11.5/byte-buddy-agent-1.11.5.jar And the Objenesis library: https://repo1.maven.org/maven2/org/objenesis/objenesis/3.2/objenesis-3.2.jar Download all these files and copy to the lib folder in our project (the same folder with the…

Dependency Injection in Java

Introduction to Dependency Injection Dependency Injection (or DI) is the injection of dependencies when they are required instead of initialization of dependencies inside the clients. We reuse the code in the previous example. The abtract class Employee: The TeamLeader.java: Now look at the addEmployee() method. The Employee object is passed (injected) to the method at…

Java Design Principles – SOLID

Introduction to Design Principles Design principles are general guidelines that were proven good coding practices. They can be applied to almost all programming languages, not just Java. The most famous of all are: – Single Responsibility Principle (S) – Open-Closed Principle (O) – Liskov Substitution Principle (L) – Interface Segregation Principle (I) – Dependency Inversion…