Flashcards

Quick study sessions to strengthen memory and retain key concepts.

Flashcard Study

Java: Mocking with Mockito

Front

How do Maven and Gradle handle dependency management differently?

Maven uses XML for configuration, while Gradle uses Groovy or Kotlin scripts. Maven's dependency management is declarative and…

View Card →
Flashcard Study

Java: Mocking with Mockito

Front

Why verify behavior without real network calls?

Mocking avoids network latency and unreliability, making tests faster and more stable. Real network calls can introduce delays…

View Card →
Flashcard Study

Java: Mocking with Mockito

Front

What are the trade-offs of using integration tests extensively?

Integration tests provide comprehensive coverage but are slower and harder to maintain. While integration tests ensure that components…

View Card →
Flashcard Study

Java: Mocking with Mockito

Front

How does Mockito control the state returned by a dependency?

Mockito uses 'when-thenReturn' to specify return values for mock methods. 'when-thenReturn' lets you define what a mock should…

View Card →
Flashcard Study

Java: Mocking with Mockito

Front

Why does the difference between mocking boundaries and mocking internals matter in practice?

Mocking boundaries focuses on external interfaces, while mocking internals can obscure code logic. Mocking boundaries involves creating mocks…

View Card →
Flashcard Study

Java: Mocking with Mockito

Front

Why use automated testing over manual testing?

Automated testing is faster, repeatable, and reduces human error. Automated tests can be run quickly and frequently, allowing…

View Card →
Flashcard Study

Java: Mocking with Mockito

Front

Why does Mockito in isolating dependencies matter in this design?

Mockito isolates code from external dependencies by creating mock objects. Mockito allows you to create mock objects for…

View Card →
Flashcard Study

Java: Mocking with Mockito

Front

When should `PaymentGateway` be mocked?

When unit testing order logic and you want to avoid real network side effects. Mocking is appropriate at…

View Card →
Flashcard Study

Java: Integration Testing

Front

Why is it important to verify component collaboration in integration tests?

To ensure components interact correctly in real-world scenarios. Verifying that components work together as expected is crucial for…

View Card →
Flashcard Study

Java: Integration Testing

Front

How do build tools like Maven help maintain project sanity?

They automate repetitive tasks and manage dependencies. Build tools streamline project management by automating tasks like compilation, testing,…

View Card →