Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add test for boolean contract with extra message argument #945

Merged
merged 1 commit into from
Mar 26, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ public void nonNullCheckIsTrueIsNotNullable() {
" Validation.checkTrue(o1 != null);",
" return o1.toString();",
" }",
" String test1WithMsg(@Nullable Object o1) {",
" Validation.checkTrue(o1 != null, \"o1 should not be null!\");",
" return o1.toString();",
" }",
" String test2(Map<String, String> map) {",
" Validation.checkTrue(map.get(\"key\") != null);",
" return map.get(\"key\").toString();",
Expand Down Expand Up @@ -553,6 +557,10 @@ private CompilationTestHelper helper() {
" static void checkTrue(boolean value) {",
" if (!value) throw new RuntimeException();",
" }",
" @Contract(\"false, _ -> fail\")",
" static void checkTrue(boolean value, String msg) {",
" if (!value) throw new RuntimeException(msg);",
" }",
" @Contract(\"true -> fail\")",
" static void checkFalse(boolean value) {",
" if (value) throw new RuntimeException();",
Expand Down