Files
spring-boot-rest/spring-5/src/test/java/com/baeldung/jupiter/Spring5JUnit5IntegrationTest.java
Loredana Crusoveanu ba77029082 remove reactive ex
2018-07-23 22:40:47 +03:00

25 lines
909 B
Java

package com.baeldung.jupiter;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.test.context.ContextConfiguration;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
@ExtendWith(SpringExtension.class)
@ContextConfiguration(classes = TestConfig.class)
class Spring5JUnit5IntegrationTest {
@Autowired
private Task task;
@Test
void givenAMethodName_whenInjecting_thenApplicationContextInjectedIntoMetho(ApplicationContext applicationContext) {
assertNotNull(applicationContext, "ApplicationContext should have been injected by Spring");
assertEquals(this.task, applicationContext.getBean("taskName", Task.class));
}
}