|
| 1 | +package org.utplsql.api; |
| 2 | + |
| 3 | +import org.junit.jupiter.api.Test; |
| 4 | +import org.utplsql.api.compatibility.CompatibilityProxy; |
| 5 | +import org.utplsql.api.compatibility.OptionalFeatures; |
| 6 | +import org.utplsql.api.exception.InvalidVersionException; |
| 7 | + |
| 8 | +import java.sql.SQLException; |
| 9 | + |
| 10 | +import static org.junit.jupiter.api.Assertions.assertEquals; |
| 11 | + |
| 12 | +public class OptionalFeaturesIT extends AbstractDatabaseTest { |
| 13 | + |
| 14 | + |
| 15 | + private Version getDatabaseVersion() throws SQLException { |
| 16 | + return new CompatibilityProxy(getConnection()).getDatabaseVersion(); |
| 17 | + } |
| 18 | + |
| 19 | + @Test |
| 20 | + public void failOnError() throws SQLException, InvalidVersionException { |
| 21 | + |
| 22 | + boolean available = OptionalFeatures.FAIL_ON_ERROR.isAvailableFor(getConnection()); |
| 23 | + |
| 24 | + if (getDatabaseVersion().isGreaterOrEqualThan(new Version("3.0.3"))) |
| 25 | + assertEquals(true, available); |
| 26 | + else |
| 27 | + assertEquals(false, available); |
| 28 | + } |
| 29 | + |
| 30 | + @Test |
| 31 | + public void frameworkCompatibilityCheck() throws SQLException, InvalidVersionException { |
| 32 | + |
| 33 | + boolean available = OptionalFeatures.FRAMEWORK_COMPATIBILITY_CHECK.isAvailableFor(getConnection()); |
| 34 | + |
| 35 | + if (getDatabaseVersion().isGreaterOrEqualThan(new Version("3.0.3"))) |
| 36 | + assertEquals(true, available); |
| 37 | + else |
| 38 | + assertEquals(false, available); |
| 39 | + } |
| 40 | + |
| 41 | + @Test |
| 42 | + public void customReporters() throws SQLException, InvalidVersionException { |
| 43 | + |
| 44 | + boolean available = OptionalFeatures.CUSTOM_REPORTERS.isAvailableFor(getConnection()); |
| 45 | + |
| 46 | + if (getDatabaseVersion().isGreaterOrEqualThan(new Version("3.1.0"))) |
| 47 | + assertEquals(true, available); |
| 48 | + else |
| 49 | + assertEquals(false, available); |
| 50 | + } |
| 51 | +} |
0 commit comments