Last active
May 27, 2019 13:56
-
-
Save betray32/7dd390cac82eba6d48f24f3bdc068304 to your computer and use it in GitHub Desktop.
Junit 5 y SpringBootTest
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package cl.testing.test; | |
import static org.junit.Assert.assertTrue; | |
import org.apache.commons.logging.Log; | |
import org.apache.commons.logging.LogFactory; | |
import org.junit.jupiter.api.AfterEach; | |
import org.junit.jupiter.api.BeforeEach; | |
import org.junit.jupiter.api.Test; | |
import org.springframework.beans.factory.annotation.Autowired; | |
import org.springframework.boot.test.context.SpringBootTest; | |
import cl.testing.dao.ConexionQueryDirecta; | |
/** | |
* Probar la conexion directa | |
* | |
* @author ccontrerasc | |
* | |
*/ | |
@SpringBootTest | |
class ConexionDirectaTest { | |
/** | |
* LOG | |
*/ | |
private static final Log log = LogFactory.getLog(ConexionDirectaTest.class); | |
/** | |
* Conexion con las Querys | |
*/ | |
@Autowired | |
private ConexionQueryDirecta queryDirecta; | |
@BeforeEach | |
void setUp() throws Exception { | |
log.info("-------------------------------"); | |
log.info("Inicializando Test para [ConexionQueryDirecta]"); | |
} | |
@AfterEach | |
void tearDown() throws Exception { | |
log.info("Test Finalizado para [ConexionQueryDirecta]"); | |
} | |
/** | |
* testConsultaQueryDirecta | |
*/ | |
@Test | |
void testConsultaQueryDirecta() { | |
log.info("Consultando Query Directa"); | |
assertTrue(queryDirecta.consultaQueryDirecta()); | |
} | |
/** | |
* testConsultaQueryParam | |
*/ | |
@Test | |
void testConsultaQueryParam() { | |
int idPersona = 1; | |
log.info("Consultando por el id : " + idPersona); | |
assertTrue(queryDirecta.consultaQueryParam(idPersona)); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment