-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
dd9d1fe
commit 2059ece
Showing
6 changed files
with
74 additions
and
46 deletions.
There are no files selected for viewing
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
File renamed without changes.
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
/**{% if false %}*/ | ||
|
||
package example; | ||
|
||
import com.leakyabstractions.result.api.Result; | ||
import org.junit.jupiter.api.DisplayName; | ||
import org.junit.jupiter.api.Test; | ||
import static com.leakyabstractions.result.core.Results.success; | ||
|
||
/** {% elsif true %}Import result assertions */ | ||
import static com.leakyabstractions.result.assertj.ResultAssertions.assertThat; | ||
|
||
/*{% endif %}{% if false %}*/ | ||
|
||
@DisplayName("Example1") | ||
class Example1_Test { | ||
|
||
/** {% elsif true %} Use result assertions */ | ||
@Test | ||
public void should_pass() { | ||
// Given | ||
final int zero = 0; | ||
// When | ||
final Result<Integer, String> result = success(zero); | ||
// Then | ||
assertThat(zero).isZero(); | ||
assertThat(result).hasSuccess(zero); | ||
} // End{% endif %}{% if false %} | ||
|
||
} | ||
// {% endif %} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
/**{% if false %}*/ | ||
|
||
package example; | ||
|
||
import com.leakyabstractions.result.api.Result; | ||
import org.junit.jupiter.api.DisplayName; | ||
import org.junit.jupiter.api.Test; | ||
import static com.leakyabstractions.result.core.Results.success; | ||
|
||
/** {% elsif true %}Import result assertions */ | ||
import static com.leakyabstractions.result.assertj.ResultAssert.assertThatResult; | ||
import static org.assertj.core.api.Assertions.assertThat; | ||
|
||
/*{% endif %}{% if false %}*/ | ||
|
||
@DisplayName("Example2") | ||
class Example2_Test { | ||
|
||
/** {% elsif true %} Use result assertions */ | ||
@Test | ||
public void should_pass_too() { | ||
// Given | ||
final int zero = 0; | ||
// When | ||
final Result<Integer, String> result = success(zero); | ||
// Then | ||
assertThat(zero).isZero(); | ||
assertThatResult(result).hasSuccess(zero); | ||
} // End{% endif %}{% if false %} | ||
|
||
} | ||
// {% endif %} |