exam questions

Exam 2V0-72.22 All Questions

View all questions & answers for the 2V0-72.22 exam

Exam 2V0-72.22 topic 1 question 54 discussion

Actual exam question from VMware's 2V0-72.22
Question #: 54
Topic #: 1
[All 2V0-72.22 Questions]

Which two statements are true regarding Spring Boot Testing? (Choose two.)

  • A. @TestApplicationContext is used to define additional beans or customizations for a test.
  • B. Test methods in a @SpringBootTest class are transactional by default.
  • C. @SpringBootTest is typically used for integration testing.
  • D. Test methods annotated with @SpringBootTest will recreate the ApplicationContext.
  • E. @SpringBootTest without any configuration classes expects there is only one class annotated with @SpringBootConfiguration in the application.
Show Suggested Answer Hide Answer
Suggested Answer: CD 🗳️

Comments

Chosen Answer:
This is a voting comment (?). It is better to Upvote an existing comment if you don't have anything to add.
Switch to a voting comment New
quakquak3
1 month, 1 week ago
Selected Answer: CE
@SpringBootTest methods are not transactional by default. This is the case for @DataJpaTest. The ApplicationContext is not recreated for each @SpringBootTest, only if a differently configured context is needed or the context has been removed because of @DirtiesContext annotation. If no configuration is specified, then @SpringBootTest searches for @SpringBootConfiguration (see https://docs.spring.io/spring-boot/api/java/org/springframework/boot/test/context/SpringBootTest.html#classes() ) and there must only be one class annotated with @SpringBootConfiguration (see https://docs.spring.io/spring-boot/api/java/org/springframework/boot/SpringBootConfiguration.html )
upvoted 1 times
...
Peit
1 month, 1 week ago
Selected Answer: CE
@SpringBootTest loads the application context, but does not automatically recreate it for each test method.
upvoted 1 times
...
Uteman
3 months, 2 weeks ago
D I mean, B is correct
upvoted 1 times
...
Uteman
3 months, 2 weeks ago
B - is not entirely true, Test methods annotated with @SpringBootTest do not recreate the ApplicationContext for each test method. Instead, the ApplicationContext is created once per test class, and it is cached and shared across multiple test methods in the same class (or even across different test classes), unless specifically instructed otherwise.
upvoted 1 times
...
Evoila_TrainingMaterial
5 months, 2 weeks ago
Selected Answer: BC
The correct answers are: B. Test methods in a @SpringBootTest class are transactional by default. C. @SpringBootTest is typically used for integration testing. Explanation: B. Test methods in a @SpringBootTest class are transactional by default. This means that any changes to the database made by a test method will be rolled back by default. C. @SpringBootTest is typically used for integration testing. It provides a full Spring ApplicationContext, including all of the infrastructure beans, as well as your application's beans. It is also capable of starting a web server, making it ideal for testing web applications, and testing a broad range of application components.
upvoted 1 times
...
2211094
7 months, 1 week ago
BC is correct answer.
upvoted 1 times
...
asaladino75
10 months, 3 weeks ago
Selected Answer: E
I think the E answere is correct. see https://docs.spring.io/spring-boot/docs/current/api/org/springframework/boot/test/context/SpringBootTest.html the @SpringBootTest is not applicable at method level.
upvoted 2 times
...
Glothan
1 year, 1 month ago
Selected Answer: CD
A is wrong: there is no @TestApplicationContext annotation in Spring Testing.
upvoted 1 times
...
Tolo01
1 year, 5 months ago
Selected Answer: AC
I think A and C are the best answer
upvoted 1 times
nesreenmhd123
1 year, 3 months ago
There is no @TestApplicationContext annotation in Spring Testing.
upvoted 1 times
...
...
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.

SaveCancel
Loading ...
exam
Someone Bought Contributor Access for:
SY0-701
London, 1 minute ago