Step 1: Create a simple maven project say “code-quality”
Step 2: Import into eclipse.
#1. Validator code & unit testing
Step 3: Validator interface & implementation
Step 4: Write a unit test to test the “ValidatorImpl.java”.
…
Step 1: Create a simple maven project say “code-quality”
Step 2: Import into eclipse.
#1. Validator code & unit testing
Step 3: Validator interface & implementation
Step 4: Write a unit test to test the “ValidatorImpl.java”.
…
Java does not have a sizeof operator like C++ does. Java uses automatic memory management known as the Garbage Collection, hence it is not that important to evaluate size of various objects. But, for the purpose of learning & fixing any potential memory issues, I have used “jvisualvm”, … Read...
This is a companion post to 8 Java Memory Management Interview Q&A demonstrating a memory leak scenario step by step with jvisualvm, which is a free profiling tool that gets shipped with JDK. Step 1: Code that causes memory leak Here is a sample code that causes memory leak. …...
Step 1: Create a simple Maven project from a command-line. Just press enter for all the prompts.
Step 2: Import the above “simple-mocking-test” in the file system into eclipse. File –> Import –> “Existing Maven Projects” and then select the “simple-mocking-test”
…
This extends Part 1: Unit testing with JUnit, Mockito & Spring by mocking the DAO layer with the Mockito framework. Step 1: Service and DAO layer interfaces and implementations Service Layer DAO Layer This layer will be mocked by Mockito in the next step. … Read more ›...
This extends Part 2: Mockito to fully mock the DAO layer by modifying the service layer to demonstrate partial mocking with “Mockito.spy”. In the “SimpleServiceImpl” we are interested in only testing the method “processUser(int id)” and want to mock the method “getUserById(int id)” by always returning “Sam”. So, … Read...