Last active
March 19, 2022 08:39
-
-
Save ankschoubey/ea3cb41308c19f56c69eb40d7e05cec1 to your computer and use it in GitHub Desktop.
format for writing clean junit tests
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class {NameOfClass}Tests{ | |
@Nested | |
@DisplayName("{methodName} method") | |
class {MethodName}Tests{ | |
@Nested | |
@DisplayName("WHEN {condition description}") | |
class {ConditionDescription}Tests{ | |
@Nested | |
@DisplayName("SHOULD {assertion description}") | |
class {AssertionDescription}Tests{ | |
// GIVEN | |
{code for setting conditions describe in WHEN block} | |
// WHEN | |
{code for running actions} | |
// THEN | |
{code for assertions} | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment