package com.swacorp.qmo.opssuite;
import com.swacorp.qmo.opssuite.listeners.ExtentTestExecutionListener;
import com.swacorp.qmo.opssuite.tests.TestAgent;
import lombok.extern.slf4j.Slf4j;
import org.assertj.core.api.SoftAssertions;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.TestExecutionListeners;
import org.springframework.test.context.testng.AbstractTestNGSpringContextTests;
import org.springframework.web.client.RestTemplate;
@SpringBootTest(classes = ApplicationConfig.class)
@TestExecutionListeners(value = {ExtentTestExecutionListener.class}, mergeMode = TestExecutionListeners.MergeMode.REPLACE_DEFAULTS)
@Slf4j
public abstract class AbstractTestNgBaseTest extends AbstractTestNGSpringContextTests {
private TestAgent testAgent;
private SoftAssertions softAssertions;
private RestTemplate restTemplate;
public TestAgent getTestAgent() {
return explicitlyWireBean(TestAgent.class);
}
public SoftAssertions getSoftAssertions() {
return explicitlyWireBean(SoftAssertions.class);
}
public RestTemplate getRestTemplate() {
return explicitlyWireBean(RestTemplate.class);
}
private <T> T explicitlyWireBean(Class<T> clazz) {
return this.applicationContext.getBean(clazz);
}
}
Comments
Post a Comment