Мне нужно заполнить мои тесты ScalaTest полями @Autowired
из контекста Spring, но большинство тестов Scalatest (например, FeatureSpec
не может быть запущено SpringJUnit4ClassRunner.class
-
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations="myPackage.UnitTestSpringConfiguration", loader=AnnotationConfigContextLoader.class)
public class AdminLoginTest {
@Autowired private WebApplication app;
@Autowired private SiteDAO siteDAO;
(Java, но вы получаете суть).
Как заполнить поля @Autowired
из ApplicationContext
для ScalaTest?
class AdminLoginFeatureTest extends FeatureSpec with GivenWhenThen with ShouldMatchersForJUnit {
@Autowired val app: WebApplication = null
@Autowired val siteDAO: SiteDAO = null
feature("Admin Login") {
scenario("Correct username and password") {...}