A UserManager directly:
What is the BIGGEST design issue?
SRP — too many unrelated responsibilities.
A pure validation method is tested with no database, no files, and no external systems.
What type of test is this?
Unit test.
You only need a dependency to return one fixed value during a test.
Which test double is MOST appropriate?
Stub
Question
A UI button handler contains:
What is the BEST first refactor direction?
Separate responsibilities into layers/classes.
True or False:
Dependency Injection and Dependency Inversion Principle are the same concept.
False.
A subclass of Bird throws:
UnsupportedOperationException
when:
fly()
is called.
What principle is MOST clearly being violated?
LSP
A manager class is tested using a fake repository backed by an ArrayList.
What type of test is this MOST likely?
Integration test across a seam.
You want to verify that:
sendEmail()
was called exactly once.
Which test double is MOST appropriate?
Mock.
Three classes duplicate the same password validation logic.
What design problem exists?
DRY violation / duplicated logic.
True or False:
A test using a fake repository can still be considered integration testing.
True
A team adds:
to a 300-line student project with two screens and no persistence.
What design issue is MOST likely occurring?
Overengineering / violating KISS or YAGNI.
A test launches the full application, clicks buttons, and saves data into SQLite.
What type of test is this?
End-to-end test.
You want realistic persistence behaviour without using a real SQL database.
Which test double is MOST appropriate?
False
A class creates all dependencies internally using:
new
What design improvement would MOST improve testability?
Dependency injection.
What is the MAIN advantage of depending on interfaces instead of concrete classes?
Reduced coupling / easier substitution/testing.
A checkout system supports new payment methods by adding new strategy classes without modifying checkout logic.
What principle is MOST clearly being followed?
OCP
A test checks communication between:
but does not involve the UI.
What type of test is this?
Integration test.
You are testing a pure calculator class with no external dependencies.
Which test double is MOST appropriate?
Real object (no double needed).
A system already uses constructor injection but still depends directly on concrete classes.
What important design principle is still weak?
DIP
Why can excessive mocking become dangerous?
Tests become brittle and overly coupled to implementation details.
A team creates:
but responsibilities overlap heavily and developers are unsure where new logic should go.
What is the MOST significant design problem?
Low cohesion / poor separation of concerns.
A test mocks every dependency, including:
What major testing problem is MOST likely occurring?
Over-mocking / brittle test design.
You want mostly real behaviour, but need to override one method during testing.
Which test double is MOST appropriate?
Spy
A student proposes:
for a tiny application with two screens.
What design problem is MOST likely occurring?
Overengineering / violating KISS or YAGNI.
A design contains many interfaces and abstractions but is difficult to understand or modify.
What important lesson does this illustrate?
More abstraction does not automatically mean better design.
IT DEPENDS (on where/why we use them)