Monday, January 8, 2018

Solving "JPA Project Change Event Handler (waiting)" annoying message from Eclipse

I'm using Eclipse Oxygen IDE and I'm always getting this annoying message "JPA Project Change Event Handler (waiting)" after saving a file, but I'm not using JPA in my project.

I tried to turn off the JPA validators under Preferences, with no success and the message kept appearing. Now I've found out that the guilty for the message appearing is the Dali/JPT plugin.
Since I do not need this plugin, I uninstalled it from the "Preferences" > "Install/Update"> then click again in the "Uninstall or update" link under that tab and finally I've selected, from the "Installed Software", the "Dali Java Persistence Tools - JPA Support" entry. Then I uninstallled it.

Problem solved!

Monday, November 20, 2017

Solving SLF4J: Class path contains multiple SLF4J bindings.

While running unit tests, if you ever find these warnings, logged with INFO...

SLF4J: Class path contains multiple SLF4J bindings.
[INFO] SLF4J: Found binding in [jar:file:/C:/apache-maven-3.3.3/mvn.release.repo/org/slf4j/slf4j-log4j12/1.7.2/slf4j-log4j12-1.7.2.jar!/org/slf4j/impl/StaticLoggerBinder.class]
[INFO] SLF4J: Found binding in [jar:file:/C:/apache-maven-3.3.3/mvn.release.repo/org/slf4j/slf4j-nop/1.7.2/slf4j-nop-1.7.2.jar!/org/slf4j/impl/StaticLoggerBinder.class]
[INFO] SLF4J: See for an explanation.
[INFO] SLF4J: Actual binding is of type [org.slf4j.impl.Log4jLoggerFactory]

The solution for fixing this is....
Use the maven surefire plugin to exclude the org.slf4j:slf4j-log4j12 usage during tests (slf4j-nop-1.7.2 is only used during tests)

pom.xml extract:

                 <classpathDependencyExcludes> org.slf4j:slf4j-log4j12 </classpathDependencyExcludes>
<dependencies>    <dependency>         <groupId>org.slf4j</groupId>         <artifactId>slf4j-api</artifactId>     </dependency>     <dependency>         <groupId>org.slf4j</groupId>         <artifactId>slf4j-nop</artifactId>         <version>1.7.2</version>         <scope>test</scope>     </dependency>   <dependency>

Friday, November 17, 2017

Java Unit Test Frameworks

I love writting unit tests for my code. It makes it easy to test code that is very hard to test in a running system, just for checking the behavior of certain implementations. Besides that, is useful when trying to refactor some code, so we can assure that the behavior is not broken.
Well, I'll show you the java unit test frameworks that I currently use...


The JUnit Platform serves as a foundation for launching testing frameworks on the JVM
JUnit 5 user guide is available as documentation.

Nice features:
Parameterized tests make it possible to run a test multiple times with different arguments.
Supports annotations.

import org.junit.*;

public class TestXXX {
    public static void setUpClass() throws Exception {
        // Code executed before the first test method

    public void setUp() throws Exception {
        // Code executed before each test
    public void testOneThing() {
        // Code that tests one thing
    public void tearDown() throws Exception {
        // Code executed after each test 
    public static void tearDownClass() throws Exception {
        // Code executed after the last test method 


EasyMock provides dynamically generated Mock objects (at runtime), without having to implement them.
Can be used in conjunction with Junit.

public class XXXTest extends TestCase {

    public void tesComputeValue(){
        ClassUnderTest testObject = new ClassUnderTest();
        ClassToMock mock = EasyMock.createMock(ClassToMock.class);
        assertEquals("Hello", testObject.saySomething(mock));


PowerMock is an extension to both Mockito and EasyMock that allows mocking of static methods, constructors, final classes and methods, private methods, removal of static initializers and more.
Allows the usage of the beneficts of PowerMock and the usage of Mockito to setup and verify expectations by using PowerMockito.

public class XXXTest {
  private ClassToMock mock;
  private ClassUnderTest testObject;

  public void tesComputeValue() {
    mock = PowerMockito.mock(ClassToMock.class);
    testObject = new ClassUnderTest(mockUserService);
    assertEquals("Hello", testObject.saySomething());


Mockito allows to verify the behavior of the system under test without establishing expectations beforehand, attempting to eliminate the expect-run-verify pattern, so the coupling is minimized.
Can be used in conjunction with Junit.

public class XXXTest {
  private ClassToMock mock;
  private ClassUnderTest testObject;
   public void setUp() {
      mock = mock(ClassToMock.class);
      testObject = new ClassUnderTest(mock);
   public void testComputeValue() throws Exception {

Nice features:
Can define the behavior of the same method call to produce different results, in the same test.


More java unit tests frameworks can be found in this wikipedia listing.

Monday, November 14, 2016

OCA/OCP Java 8 Programmer Study Guide

Exam 1Z0-808: OCA Java SE 8 Programmer I
Duration: 150 minutes
Number of Questions: 77
Passing Score: 65%

Exam Topics, Oracle
Sample Questions, Oracle

Exam 1Z0-809: OCP Java SE 8 Programmer II
Duration: 150 minutes
Number of Questions: 85
Passing Score: 65%
Exam Topics, Oracle
Sample Questions, Oracle

Online Book "Java 8 Programmer II Study Guide", Esteban Herrera

Exam 1Z0-810: Upgrade to Java SE 8 OCP from Java SE 7 OCP
Duration: 150
Number of Questions: 81
Passing Score: 65%
Exam Topics, Oracle
Sample Questions, Oracle

Mikalai Zaikin Upgrade Guide
Notes for 1Z0-810

Exam 1Z0-813: Upgrade to Java SE 8 OCP ( Java SE 6 and all prior versions)
Duration: 130 minutes
Number of Questions: 60
Passing Score: 63%
Exam Topics, Oracle
Sample Questions, Oracle

Java 8 Books:
Other Java 8 Resources:

Friday, February 13, 2015

ObjectAid UML Explorer for Eclipse

ObjectAid UML Explored for Eclipse is an Eclipse plugin to show the Java source code and libraries in live UML class and sequence diagrams, that automatically update as your code changes.

ObjectAid UML Explorer class diagram
ObjectAid UML Explorer, class diagram.

Monday, December 15, 2014

IntelliJ shortcuts

I'm using IDE IntelliJ for the first time. Until now, my favorite IDE is Eclipse. Why am I trying IntelliJ? Because everyone that uses it says that it is much better than Eclipse. So, I'm trying it to see for my self.

First of all, I've downloaded the IntelliJ Community Edition, and after running it and setting up my Project, I'm faced with a new challenge: so, what shortcuts should I use?

IntelliJ welcomes me with a few shortcut:

IntelliJ shortcuts

  • Search Everywhere with Double Shift
  • Open a file by name with Ctr + Shift + N
  • Open Recent Files with Ctrl + E
  • Open Naviagtion Bar with Alt + Home
  • Drag and Drop file(s) here from Explorer

(I' ll adding useful shortcuts as long as I discover them)

Which IDE do you prefer? Eclipse? IntelliJ? Some other? Why?

Monday, November 24, 2014

Wiki Markup language in Atlassian Crucible

Atlassian Crucible is a collaborative peer code review tool, where you can leave comments about reviews created based on some commited code.
It allows the development teams to catch major defects, improve code architecture, and discuss desired improvements, without the need for meetings. With FishEye, it lets you view the contents of your Source Code Management (SCM) repositories in your web browser.

And, it supports integration with Jira, which is a very important thing about these collaborative tools. Integration is the key for a better handling.

The Crucible documentation, the FishEye documentation and the Jira documentation can be found at the Atlassian Documentation page.

Did you know that you can use Wiki Markup in Crucible, just like for incorporating some code block in the comments? Check out this Crucible Help page about the Wiki Markup and learn how it can be used.