Skip to content
This repository was archived by the owner on Feb 12, 2026. It is now read-only.

Commit dbadc7c

Browse files
Mention that JUnit methods are only intended for use in unit tests. (#12)
1 parent fb0fbb6 commit dbadc7c

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

lecture2part2.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -462,6 +462,10 @@ This is because our invocation of `assertEquals` is wrong: the first argument sh
462462
```
463463
JUnit offers several other useful `assert` methods like `assertTrue`, `assertFalse`, `assertThrows`, `assertDoesNotThrow`, `assertInstanceOf`, `assertArrayEquals`, `assertNotEquals`, `assertSame`, `assertNotSame`, `assertNull` that one should use where appropriate.
464464

465+
It is important to note that JUnit methods are only intended for use in unit tests and they should not be used elsewhere.
466+
This is contrary to the Java keyword `assert`, which may be used in arbitrary code to perform additional sanity-checks.
467+
Such `assert` checks will normally be enabled during development but turned off in production.
468+
465469
#### Test Methods Separately ####
466470

467471
If a class has many public methods, then it is good practice to test all of them.

0 commit comments

Comments
 (0)