Sign Up Now!

Sign up and get personalized intelligence briefing delivered daily.

Sign Up

Articles related to "java"

How to use JUnit for IntelliJ idea

  • Download and install IntelliJ idea community version from here: Community version is free.
  • At first, we will add junit library.
  • Open File -> Project Structure.
  • Then open "Library".
  • Click on green + .
  • Search for junit and find something like "junit:junit:4.12".
  • Click on it and add it as library.
  • We need to add a directory for tests.
  • Create the directory: Click on OK.
  • Now you have a "Test" directory.
  • This is supposed to return 10.
  • Now run the test (right click inside unit_test1 method): Test finished.
  • Just for a test, we can change the returned value and test the method again: Test result: You can see it is correctly detecting that the returned value is different from the expected value.
  • We’re a place where coders share, stay up-to-date and grow their careers.
  • We strive for transparency and don't collect excess data.

save | comments | report | share on