Flashcards

Quick study sessions to strengthen memory and retain key concepts.

Flashcard Study

Java: Mocking with Mockito

Front

Advantages of using build tools like Maven?

Build tools automate complex tasks and ensure consistency. Build tools like Maven automate repetitive tasks such as compiling…

View Card →
Flashcard Study

Java: Mocking with Mockito

Front

Using 'when-thenReturn' in Mockito?

'when-thenReturn' sets up expected behavior for mocks. In Mockito, the 'when-thenReturn' construct is used to specify what a…

View Card →
Flashcard Study

Java: Mocking with Mockito

Front

Mocking boundaries vs internals in testing?

Mocking boundaries is preferred to maintain test stability. Mocking at the boundaries of your system (e.g., external APIs)…

View Card →
Flashcard Study

Java: Mocking with Mockito

Front

Isolating code from external APIs with Mockito?

Mockito allows you to create mock versions of external APIs. When testing a component that relies on an…

View Card →
Flashcard Study

Java: Mocking with Mockito

Front

Understanding automated testing benefits?

Automated testing is faster and more reliable than manual testing. Automated testing allows tests to be executed quickly…

View Card →
Flashcard Study

Java: Mocking with Mockito

Front

How does Gradle's 'testCompile' configuration assist in testing?

'testCompile' specifies dependencies needed for test compilation. In Gradle, 'testCompile' is used to declare libraries required to compile…

View Card →
Flashcard Study

Java: Mocking with Mockito

Front

What are the consequences of mocking internal dependencies?

Mocking internal dependencies can obscure the design and logic of the code. When internal parts of a system…

View Card →
Flashcard Study

Java: Mocking with Mockito

Front

How would you explain a common mistake when using Mockito's 'verify' method in an interview?

Failing to verify all necessary interactions can lead to incomplete tests. Mockito's 'verify' method checks that specific methods…

View Card →
Flashcard Study

Java: Mocking with Mockito

Front

How does the Maven 'test' phase integrate with the lifecycle?

The 'test' phase runs unit tests after compilation but before packaging. In Maven, the 'test' phase is part…

View Card →
Flashcard Study

Java: Mocking with Mockito

Front

Why does overusing mocks in unit tests matter in practice?

Overusing mocks can lead to tests that are tightly coupled to implementation details. When too many mocks are…

View Card →