Add junit-mockito module: 30 runnable JUnit 6.1.3 / Mockito 5.24.0 interview answers
One test per question, each writing and asserting its own transcript under output/. Covers lifecycle, extensions, parameterized and dynamic tests, mocks vs spies, verification, strict stubs, static and constructor mocking, and flaky tests. Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01CifR2BE7PBvRy5hT8TS9oz
This commit is contained in:
Executable
+13
@@ -0,0 +1,13 @@
|
||||
#!/usr/bin/env bash
|
||||
# Q27: runs one Mockito test WITHOUT the -javaagent flag and keeps only the JVM's own warning lines.
|
||||
# Writes output/q27-no-agent-warning.txt. Compare with the normal run, which prints none of these.
|
||||
set -uo pipefail
|
||||
cd "$(dirname "$0")/.."
|
||||
unset JAVA_TOOL_OPTIONS
|
||||
OUT=output/q27-no-agent-warning.txt
|
||||
mvn -B test -Dtest='D_MockitoCoreTest#q18_mockVersusSpy' \
|
||||
-Dmockito.agentArg=-Dlab.no.agent=true 2>&1 \
|
||||
| grep -E '^(WARNING|Mockito is currently self-attaching)|dynamic(ally)? load|byte-buddy|-javaagent|EnableDynamicAgentLoading' \
|
||||
| grep -v -E 'Unsafe|HiddenClassDefiner|guice' \
|
||||
| sed -E "s#/[^ ]*/\.m2/repository#~/.m2/repository#g" > "$OUT"
|
||||
cat "$OUT"
|
||||
Reference in New Issue
Block a user