This method is calling the String.format(newErrorMessage, args) even if args is empty and newErrorMessage contains '%' which makes assertion fails (See JUnit ...