-
Notifications
You must be signed in to change notification settings - Fork 0
TDD with Java and SpringBoot
Somkiat Puisungnoen edited this page May 19, 2026
·
1 revision
- A. To write the most elegant and optimized code possible
- B. To write just enough code to make the failing test pass
- C. To identify and fix bugs in the production environment
- D. To design the database schema
- A. The database connection is closed
- B. The actual result is compared against the expected outcome
- C. The method under test is executed.
- D. The test environment is initialized
- A. The test should run automatically on a schedule
- B. The developer must manually check the logs to see if the test passed
- C. The test code should be able to fix the production code automatically
- D. The test should have a clear pass/fail output without human interpretation
- A. Mocks are always faster than Stubs
- B. Stubs provide canned answers; Mocks verify that specific calls were made (behavior verification)
- C. Stubs verify behavior; Mocks provide state
- D. Stubs are used in Spring Boot; Mocks are used in Vanilla Java
- A. It allows a class to receive its dependencies from an external source (the Spring Container)
- B. It is a tool used exclusively for connecting to SQL databases
- C. It prevents the use of interfaces
- D. It manually creates every object using the 'new' keyword
- A. A full server start-up with a real database connection
- B. A slice of the Spring Context focusing only on MVC components (Controllers, Filters, etc.)
- C. Automatic generation of documentation for the API
- D. A way to test the Repository layer directly
- A. Because it handles HTTP status codes
- B. Because it writes raw SQL queries
- C. Because it contains the core logic, rules, and transaction management of the application
- D. Because it is the only layer that uses the @Bean annotation
8. In the Repository Layer, what does '@DataJpaTest' automatically do to transactions after a test method finishes ?
- A. Rolls back the transaction
- B. Sends an email notification of the test result
- C. Commits the changes to the database permanently
- D. Deletes the entire database schema
- A. It is required for every Spring Boot project
- B. It allows running the same test logic with different inputs and expected outputs to reduce code duplication
- C. It automatically fixes syntax errors in the production code
- D. It makes the test code 10 times faster
10. Which Test Double is an 'actual implementation' that is simplified (e.g., an In-Memory Database) ?
- A. Mock
- B. Spy
- C. Dummy
- D. Fake