{"record":{"id":"ac2493f94923ad5a","repo":"junit-team/junit5","slug":"messagesupplier-get","errorCode":null,"errorMessage":"${messageSupplier.get()}","messagePattern":"\\$\\{messageSupplier\\.get\\(\\)\\}","errorType":"validation","errorClass":"PreconditionViolationException","httpStatus":null,"severity":"error","filePath":"junit-platform-commons/src/main/java/org/junit/platform/commons/util/Preconditions.java","lineNumber":389,"sourceCode":"\tpublic static void condition(boolean predicate, String message) throws PreconditionViolationException {\n\t\tif (!predicate) {\n\t\t\tthrow new PreconditionViolationException(message);\n\t\t}\n\t}\n\n\t/**\n\t * Assert that the supplied {@code predicate} is {@code true}.\n\t *\n\t * @param predicate the predicate to check\n\t * @param messageSupplier precondition violation message supplier\n\t * @throws PreconditionViolationException if the predicate is {@code false}\n\t */\n\t@Contract(\"false, _ -> fail\")\n\tpublic static void condition(boolean predicate, Supplier<String> messageSupplier)\n\t\t\tthrows PreconditionViolationException {\n\n\t\tif (!predicate) {\n\t\t\tthrow new PreconditionViolationException(messageSupplier.get());\n\t\t}\n\t}\n\n}\n","sourceCodeStart":371,"sourceCodeEnd":394,"githubUrl":"https://github.com/junit-team/junit5/blob/f070c699a08b5d8393df9afd147af5c5e90bb21b/junit-platform-commons/src/main/java/org/junit/platform/commons/util/Preconditions.java#L371-L394","documentation":"Lazy-message variant of Preconditions.condition: throws PreconditionViolationException with messageSupplier.get() when the predicate is false. Identical semantics to the String variant (error 96) but the message is computed only on failure; used by hot paths to avoid building strings eagerly.","triggerScenarios":"Any internal JUnit call to Preconditions.condition(predicate, () -> \"msg\") with predicate false - same as the eager variant but on the supplier overload.","commonSituations":"Same as error 96 - API misuse, contract violation, or bad inputs to a guarded method.","solutions":["Read the message and locate the guard call site in the stack trace","Fix the caller to meet the documented contract"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":["Read the PreconditionViolationException message and the call site in the stack trace","Honour documented @param contracts on JUnit public APIs","Avoid calling org.junit.platform.commons.util internal classes directly"],"tags":["preconditions","validation","contract"],"backgroundTag":null,"analyzedSha":"f070c699a08b5d8393df9afd147af5c5e90bb21b","analyzedAt":"2026-08-11T20:31:00.530Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}