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