Return to site

๐Ÿƒ๐ŸŽ“ SPRING CERTIFICATION QUESTION: Do you use Spring in a unit test?

ยท spring,vcp,java

Answer:

Unit testing should not depend on any infrastructure framework / use it in some way in unit testing.

Spring framework advocates this non-invasive approach, thus your unit tests do not depend on Spring.

๐๐จ๐ญ๐ž: Spring framework provides some mock objects and testing support classes

that are convenient to be used in unit testing (e.g. ๐Œ๐จ๐œ๐ค๐๐ซ๐จ๐ฉ๐ž๐ซ๐ญ๐ฒ๐’๐จ๐ฎ๐ซ๐œ๐ž, ๐Œ๐จ๐œ๐ค๐„๐ง๐ฏ๐ข๐ซ๐จ๐ง๐ฆ๐ž๐ง๐ญ...).

Look at the ๐จ๐ซ๐ .๐ฌ๐ฉ๐ซ๐ข๐ง๐ ๐Ÿ๐ซ๐š๐ฆ๐ž๐ฐ๐จ๐ซ๐ค.๐ฆ๐จ๐œ๐ค package for more info.

#spring #certificationquestion #vcp

Testing in Spring Boot ๐Ÿ‘‰ https://www.baeldung.com/spring-boot-testing