Merge pull request #10192 from sk1418/abstractMethodError
[BAEL-4284] AbstractMethodError
This commit is contained in:
commit
1578788805
|
@ -17,6 +17,14 @@
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.h2database</groupId>
|
||||||
|
<artifactId>h2</artifactId>
|
||||||
|
<version>1.4.191</version>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
<!-- test scoped -->
|
<!-- test scoped -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.assertj</groupId>
|
<groupId>org.assertj</groupId>
|
||||||
|
|
|
@ -0,0 +1,23 @@
|
||||||
|
package com.baeldung.exceptions.abstractmethoderror;
|
||||||
|
|
||||||
|
|
||||||
|
import org.junit.jupiter.api.Assertions;
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
|
import java.sql.Connection;
|
||||||
|
import java.sql.DriverManager;
|
||||||
|
import java.sql.SQLException;
|
||||||
|
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertNotNull;
|
||||||
|
|
||||||
|
class AbstractMethodErrorUnitTest {
|
||||||
|
private static final String url = "jdbc:h2:mem:A-DATABASE;INIT=CREATE SCHEMA IF NOT EXISTS myschema";
|
||||||
|
private static final String username = "sa";
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void givenOldH2Database_whenCallgetSchemaMethod_thenThrowAbstractMethodError() throws SQLException {
|
||||||
|
Connection conn = DriverManager.getConnection(url, username, "");
|
||||||
|
assertNotNull(conn);
|
||||||
|
Assertions.assertThrows(AbstractMethodError.class, () -> conn.getSchema());
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue