UPDATE 2026
What is integration tests? - Answers Designed to test behaviors between objects and parts of the
overall system.
Characteristics of Integration Tests: - Answers * Much larger in scope / takes more time to run.
* Can include the Spring Context, database and message brokers.
* Will run much slower than units tests.
Functional Tests - Answers Typically means you are testing the running application.
What could be a characteristic of Functional Tests? - Answers The application is live, likely deployed in
a known environment.
How functional touch points are tested in a Functional Test? - Answers * Using a selenium web driver,
* Calling a web service,
* Sending/receiving messages etc...
TDD - Answers Test Driven Development
What is Test Driven Development? - Answers Write tests first, which will fail initially, then code to
"fix" each test.
BDD - Answers Behavior Driven Development
What is Behavior Driven Development? - Answers Builds on TDD and specifies that tests of any unit of
software should be specified in terms of desired behavior of the unit.
What are some characteristics of Behavior Driven Development? - Answers * Often implemented with
DSLs(domain specific language) to create natural language tests.
* JBehave, Cucumber, Spock.
- Spock example --> given, when, then.
What is Mock and Spy? - Answers * Mock: A fake implementation of a calss used for testing. Think of
a test stunt double.
* Spy: A partial mock, allowing you to override select methods of a real class.
Testing Goals - Answers * Generally, you will want the majority of your test to be 'unit tests'.
* Bringing up the Spring Context makes you tests exponentially slower.
* Try to test specific business logic in unit tests.
* Use integration Tests to test interactions.
What tests is more expensive to write / Time to execute? - Answers Unit testing --> Integration testing
--> Functional testing.
Which test takes the longest in Return on investment (ROI)? - Answers Unit testing --> Integration
testing --> Functional testing.
Which test has the most quantity of tests? - Answers Unit testing --> Integration testing --> Functional
testing.
Which dependencies will load using spring-boot-starter-test (default from Spring Initalizr) - Answers *
Junit → The defacto standard for unit testing Java applications.
* Spring Test and Spring Boot Test → Utilities and integration test support for Spring Bootapplications.
* AssertJ → A fluent assertion library.
* Hamcrest → A Java mocking framework.
* JSONassert → An assertion library for JSON.
* JSONPath → Xpath for JSON.
Which testing framework is one of the most popular originally written by Erich Gamma and Ken Beck?
- Answers JUnit testing Framework
Where is JUnit test located? - Answers under the test/java/
<your reverse domain>/<class_name>Tests.java
How do you create a unit test for a class? - Answers Click on the class → Alt + Enter → Create Test
Where do you use Mockito Mocks? - Answers * RecipeService
* Model
What is SpringMock MVC? - Answers * Is a feature in Spring that gives us the capabilities to test
SpringMVC controllers and to unit test them.
* SpringMock MVC will bring in a mock servlet context
Continuous Integration (CI) - Answers * is the (best) practice of merging developers code into a shared
repository
• developers integrate code frequently (several times per day)
, • each integration (commit) is then verified by invoking an automated build
• part of the build is the invocation of the automated tests (unit and integration)
• while automated tests are not strictly part of CI, it is typically implied
Continuous Deployment (CD) - Answers * Continuous software delivery approach in which teams
provide software in short cycles
• Each cycle ensures that the software can be reliably released at any time
• Its aim is to release software with greater speed and frequency
• This approach helps to reduce cost, time and risk of delivering changes by allowing formore
incremental updates.
Lombok features - Answers * One of the biggest criticisms against a Java, is the large amount of
ceremonialcode one has to code through in developing enterprise application (think pojos,properties,
setters, getters etc...)
• If you were to compare that to groovy for example ... where a developerautomatically has getters
and setters provided by default (under the covers).
• What Project Lombok provides... it makes available a set of new annotations fordevelopers to use to
add in things like getters/setters, builders, loggers and alot more
.• Benefit → Simplifies development and eliminates even more boilerplate code.
How Lombok Works? - Answers * Hooks in via Annotation processor API
• The raw source code (AST/Abstract Syntax Tree) is passed to Lombok for codegeneration before the
Java compiler continues.
• As a consequence, Lombok produces compiled Java code in conjunction withthe Java compiler
.• Under the "target/classes" folder in your project you can view the compiledclass files
• Intellij will decompile to show you the source code.
Lombok dependency - Answers <dependency>
<groupId>org.projectlombok</goupId>
<artifactId>lomobok</artifactId>
</dependency>
What are the two Fetch Types - Answers * Lazy Fetch Type
• Data is not required until referenced
* Eager Fetch Type
• Data is queried up front
How emdeddable types are use in JPA/Hibernate? - Answers * Are used to define a common set of
properties
• For example, an order might have a billing address, and a shipping address
• An embeddable type could be used for the address properties
How Hibernate support inheritance? - Answers @MappedSuperclass - Entities inherit from a super
class. A database table IS NOT created for thesuper class
.• Single Table - (Hibernate Default) - One table is used for all subclasses
• @Inheritance(strategy = InheritanceType.SINGLE_TABLE)• Joined Table - Base Class and subclasses
have their own tables. Fetching entities requires a join tothe parent table.
• @Inheritance(strategy = InheritanceType.JOINED)• Table Per Class - Each subclasses has its own
table
• @Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)
When is a good practice to use Timestamps? - Answers Often its best practice to use create and
update timestamps on your entities for audit purposes.
Give an example of DDL and DML. - Answers • DDL = Data Definition Language (ex schema)