All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.bedrin.jdbc.sniffer.junit.package-info Maven / Gradle / Ivy

/**
 * JDBC Sniffer has a convenient integration with JUnit
 * Consider this example:
 * 
 * 
 * public class UsageTest {
 *     // Integrate JDBC Sniffer to your test using @Rule annotation and a QueryCounter field
 *     {@literal @}Rule
 *     public final QueryCounter queryCounter = new QueryCounter();
 *
 *     // Now just add @Expectation or @Expectations annotations to define number of queries allowed for given method
 *     {@literal @}Test
 *     {@literal @}Expectation(1)
 *     public void testJUnitIntegration() throws SQLException {
 *         // Just add sniffer: in front of your JDBC connection URL in order to enable sniffer
 *         final Connection connection = DriverManager.getConnection("sniffer:jdbc:h2:mem:", "sa", "sa");
 *         // Do not make any changes in your code - just add the @Rule QueryCounter and put annotations on your test method
 *         connection.createStatement().execute("SELECT 1 FROM DUAL");
 *     }
 * }
 * }
 * 
 * 
* @see com.github.bedrin.jdbc.sniffer.junit.QueryCounter * @see com.github.bedrin.jdbc.sniffer.Expectations * @see com.github.bedrin.jdbc.sniffer.Expectation * @see com.github.bedrin.jdbc.sniffer.NoQueriesAllowed */ package com.github.bedrin.jdbc.sniffer.junit;




© 2015 - 2024 Weber Informatics LLC | Privacy Policy