|
| 1 | +package org.utplsql.api.outputBuffer; |
| 2 | + |
| 3 | +import org.junit.jupiter.api.Test; |
| 4 | +import org.utplsql.api.AbstractDatabaseTest; |
| 5 | +import org.utplsql.api.Version; |
| 6 | +import org.utplsql.api.compatibility.CompatibilityProxy; |
| 7 | +import org.utplsql.api.reporter.CoreReporters; |
| 8 | +import org.utplsql.api.reporter.Reporter; |
| 9 | +import org.utplsql.api.reporter.ReporterFactory; |
| 10 | + |
| 11 | +import java.sql.SQLException; |
| 12 | + |
| 13 | +import static org.hamcrest.MatcherAssert.assertThat; |
| 14 | +import static org.hamcrest.core.IsInstanceOf.instanceOf; |
| 15 | + |
| 16 | +public class OutputBufferProviderIT extends AbstractDatabaseTest { |
| 17 | + |
| 18 | + @Test |
| 19 | + void testGettingPre310Version() throws SQLException { |
| 20 | + |
| 21 | + CompatibilityProxy proxy = new CompatibilityProxy(getConnection(), Version.V3_0_4); |
| 22 | + ReporterFactory reporterFactory = ReporterFactory.createDefault(proxy); |
| 23 | + |
| 24 | + Reporter r = reporterFactory.createReporter(CoreReporters.UT_DOCUMENTATION_REPORTER.name()); |
| 25 | + r.init(getConnection(), proxy, reporterFactory); |
| 26 | + |
| 27 | + OutputBuffer buffer = proxy.getOutputBuffer(r, getConnection()); |
| 28 | + |
| 29 | + assertThat(buffer, instanceOf(CompatibilityOutputBufferPre310.class)); |
| 30 | + } |
| 31 | + |
| 32 | + @Test |
| 33 | + void testGettingActualVersion() throws SQLException { |
| 34 | + CompatibilityProxy proxy = new CompatibilityProxy(getConnection(), Version.LATEST); |
| 35 | + ReporterFactory reporterFactory = ReporterFactory.createDefault(proxy); |
| 36 | + |
| 37 | + Reporter r = reporterFactory.createReporter(CoreReporters.UT_DOCUMENTATION_REPORTER.name()); |
| 38 | + r.init(getConnection(), proxy, reporterFactory); |
| 39 | + |
| 40 | + OutputBuffer buffer = proxy.getOutputBuffer(r, getConnection()); |
| 41 | + |
| 42 | + assertThat(buffer, instanceOf(DefaultOutputBuffer.class)); |
| 43 | + } |
| 44 | +} |
0 commit comments