| 1 |
|
package org.europa.together.domain; |
| 2 |
|
|
| 3 |
|
import java.lang.reflect.Constructor; |
| 4 |
|
import org.europa.together.JUnit5Preperator; |
| 5 |
|
import org.europa.together.application.JdbcActions; |
| 6 |
|
import org.europa.together.application.LogbackLogger; |
| 7 |
|
import org.europa.together.business.DatabaseActions; |
| 8 |
|
import org.europa.together.business.Logger; |
| 9 |
|
import static org.junit.jupiter.api.Assertions.*; |
| 10 |
|
import org.junit.jupiter.api.Test; |
| 11 |
|
import org.junit.jupiter.api.extension.ExtendWith; |
| 12 |
|
|
| 13 |
|
@SuppressWarnings("unchecked") |
| 14 |
|
@ExtendWith({JUnit5Preperator.class}) |
| |
|
| 95.8% |
Uncovered Elements: 1 (24) |
Complexity: 3 |
Complexity Density: 0.14 |
|
| 15 |
|
public class JdbcConnectionTest { |
| 16 |
|
|
| 17 |
|
private static final Logger LOGGER = new LogbackLogger(JdbcConnectionTest.class); |
| 18 |
|
private static DatabaseActions actions = new JdbcActions(); |
| 19 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (5) |
Complexity: 1 |
Complexity Density: 0.2 |
1PASS
|
|
| 20 |
1 |
@Test... |
| 21 |
|
void privateConstructor() throws Exception { |
| 22 |
1 |
LOGGER.log("TEST CASE: constructor", LogLevel.DEBUG); |
| 23 |
|
|
| 24 |
1 |
Constructor<JdbcConnection> clazz |
| 25 |
|
= JdbcConnection.class.getDeclaredConstructor(); |
| 26 |
1 |
clazz.setAccessible(true); |
| 27 |
1 |
assertThrows(Exception.class, () -> { |
| 28 |
1 |
JdbcConnection call = clazz.newInstance(); |
| 29 |
|
}); |
| 30 |
|
} |
| 31 |
|
|
| |
|
| 94.1% |
Uncovered Elements: 1 (17) |
Complexity: 2 |
Complexity Density: 0.12 |
1PASS
|
|
| 32 |
1 |
@Test... |
| 33 |
|
void jdbcMetData() { |
| 34 |
1 |
LOGGER.log("TEST CASE: getJdbcMetaData", LogLevel.DEBUG); |
| 35 |
|
|
| 36 |
1 |
try { |
| 37 |
1 |
DatabaseActions actions = new JdbcActions(); |
| 38 |
1 |
actions.connect("test"); |
| 39 |
1 |
JdbcConnection metaData = actions.getJdbcMetaData(); |
| 40 |
|
|
| 41 |
1 |
LOGGER.log(metaData.toString(), LogLevel.DEBUG); |
| 42 |
1 |
assertNotNull(metaData.CATALOG); |
| 43 |
1 |
assertNotNull(metaData.DBMS_NAME); |
| 44 |
1 |
assertNotNull(metaData.DBMS_VERSION); |
| 45 |
1 |
assertNotNull(metaData.DRIVER_NAME); |
| 46 |
1 |
assertNotNull(metaData.DRIVER_VERSION); |
| 47 |
1 |
assertNotNull(metaData.JDBC_VERSION); |
| 48 |
1 |
assertNotNull(metaData.IP); |
| 49 |
1 |
assertNotNull(metaData.PORT); |
| 50 |
1 |
assertNotNull(metaData.URL); |
| 51 |
1 |
assertNotNull(metaData.USER); |
| 52 |
|
} catch (Exception ex) { |
| 53 |
0 |
LOGGER.catchException(ex); |
| 54 |
|
} |
| 55 |
|
} |
| 56 |
|
} |