_Cover image by [Hans-Peter Gauster](https://unsplash.com/@sloppyperfectionist) on [Unsplash](https://unsplash.com/)_
We all have been there: we s...
For further actions, you may consider blocking this person and/or reporting abuse
Great intro. I hit an error on line 11 of the final code. I get an
Error:(11, 16) java: Math() has private access in Math
. IntelliJ's linter is yelling about it as well. My Java knowledge is minimal so I'm wondering how would I fix this error? I'm guessing it has something to do with line 2 ofMath.java
.Thanks for letting me know, Seth!
That's my fault.
Try removing this from the Math.java file:
The entire class should be like this now:
In case you or someone else also wonders why, the
private Math() {}
refers to the constructor of our Math class, I made itprivate
at the beginning because all it's methods arestatic
, which prevents anyone from trying to instantiate it. But later on I decided to also add an example where we had the need to use an object and I forgot to update it hahaha.That works. Thanks!
Hi, just a small hint. In case you add a dependency in Maven which is only intended for testing, which TestNG is, you should do it like this:
Apart from that if suggest to name a test class
*Tests.java
you have add an example to use the most recent versions of maven-surefire-plugin (2.21.0+). Otherwise this will not being executed as test. The best it to name it*Test.java
this will work with older versions well..Thank you, Karl!
That's really helpful 😄
Just to give some other options: We’ve just started using JUnit 5, the best thing is actually @DisplayName to price a readable test name. Also, we switched to AssertJ that has a pretty neat fluent API.
Very well explained as usual (> ._.)> Kuddos!. This is really helpful since Im trying to implement a new testing framework for the folks at work, wish you luck and here your reward.
Hahahha, thanks Manuel!
I'm glad you found it useful 🤓
Great post
Great article!
Hey Christian,
Which IDE do you prefer? :)
Good article!
Hi Francesca, I would say that IntelliJ IDEA is my favorite overall. But I've also found text editors with plugins to be really good as well with a couple of plugins like VS Code.
Awesome guide. This is a great refresher for me as I have not wrote some unit tests in a while 😬
One of the best articles that I found on the whole web, Thank you, sir.
But I got "Error:(3, 34) java: package org.graalvm.compiler.debug does not exist" when I type expectedExceptions.
Hey Mohammad,
Thank you very much!
I'm not entirely sure what might cause it, but it seems you are missing a dependency.
In case it might help you, here's a repository with the project I used while making this article: github.com/chrisvasqm/intro-unit-t...
This is a great post. thank you very much Christian Vasquez
Great Article, Thank you!