0
0
JUnittesting~5 mins

Dummy objects in JUnit - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What is a dummy object in software testing?
A dummy object is a simple placeholder used in tests to fill parameter lists or satisfy method signatures without affecting the test outcome.
Click to reveal answer
beginner
Why do we use dummy objects in unit tests?
We use dummy objects to avoid null values and to satisfy method parameters when the actual object is not needed for the test logic.
Click to reveal answer
intermediate
How is a dummy object different from a mock object?
A dummy object is just a placeholder and does not have behavior, while a mock object simulates behavior and can verify interactions.
Click to reveal answer
beginner
Example of creating a dummy object in JUnit tests?
In JUnit, you can create a dummy object by instantiating a simple class or using a mock library to create an object that is not used in assertions.
Click to reveal answer
intermediate
When should you avoid using dummy objects?
Avoid dummy objects when the test requires real behavior or interaction; use mocks or stubs instead to simulate behavior.
Click to reveal answer
What is the main purpose of a dummy object in testing?
ATo replace the system under test
BTo simulate complex behavior
CTo fill parameter lists without affecting test logic
DTo verify method calls
Which of the following is NOT true about dummy objects?
AThey verify interactions
BThey have no behavior
CThey prevent null pointer exceptions
DThey satisfy method signatures
In JUnit, how can you create a dummy object?
AUse a real database connection
BUse a mock to verify calls
CWrite assertions on the dummy
DInstantiate a simple class with no logic
When should you NOT use a dummy object?
AWhen the object is not used in the test
BWhen you need to simulate behavior
CWhen you want to avoid nulls
DWhen filling unused parameters
Which test double is a dummy object closest to?
ANone, it is just a placeholder
BStub
CMock
DFake
Explain what a dummy object is and why it is useful in unit testing.
Think about objects that just fill space in method calls.
You got /4 concepts.
    Describe the difference between dummy objects and mocks in testing.
    Compare their roles in test logic and verification.
    You got /4 concepts.