| 1 |
|
package guru.mikelue.foxglove.jdbc; |
| 2 |
|
|
| 3 |
|
import java.util.List; |
| 4 |
|
|
| 5 |
|
import org.junit.jupiter.api.AfterEach; |
| 6 |
|
import org.junit.jupiter.api.BeforeEach; |
| 7 |
|
import org.junit.jupiter.api.Test; |
| 8 |
|
|
| 9 |
|
import guru.mikelue.misc.testlib.AbstractTestBase; |
| 10 |
|
|
| 11 |
|
import guru.mikelue.foxglove.setting.DataSetting; |
| 12 |
|
|
| 13 |
|
import static guru.mikelue.foxglove.ColumnMetaTestUtils.newColumnMeta; |
| 14 |
|
import static java.sql.JDBCType.INTEGER; |
| 15 |
|
import static java.sql.JDBCType.VARCHAR; |
| 16 |
|
import static org.assertj.core.api.Assertions.assertThat; |
| 17 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (9) |
Complexity: 4 |
Complexity Density: 0.8 |
|
| 18 |
|
public class RowParamsGeneratorTest extends AbstractTestBase { |
| |
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
| 19 |
1 |
public RowParamsGeneratorTest() {}... |
| 20 |
|
|
| |
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
| 21 |
1 |
@BeforeEach... |
| 22 |
|
void setup() {} |
| 23 |
|
|
| |
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
| 24 |
1 |
@AfterEach... |
| 25 |
|
void tearDown() {} |
| 26 |
|
|
| 27 |
|
|
| 28 |
|
@link@link |
| 29 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (5) |
Complexity: 1 |
Complexity Density: 0.2 |
1PASS
|
|
| 30 |
1 |
@Test... |
| 31 |
|
void resolveSupplier() |
| 32 |
|
{ |
| 33 |
1 |
var settings = new DataSetting() |
| 34 |
|
.givenType(VARCHAR) |
| 35 |
|
.useSupplier(() -> "v2") |
| 36 |
|
.givenType(INTEGER) |
| 37 |
|
.useSupplier(() -> 40); |
| 38 |
|
|
| 39 |
1 |
var tableFacet = JdbcTableFacet.builder("any_table") |
| 40 |
|
.column("st_col2").fixed("v1") |
| 41 |
|
.build(); |
| 42 |
|
|
| 43 |
1 |
var sampleMetaOfColumns = List.of( |
| 44 |
|
|
| 45 |
|
newColumnMeta("st_col2"), |
| 46 |
|
|
| 47 |
|
newColumnMeta("st_col1", INTEGER), |
| 48 |
|
|
| 49 |
|
newColumnMeta("st_col3") |
| 50 |
|
); |
| 51 |
|
|
| 52 |
1 |
var testedRow= new RowParamsGenerator( |
| 53 |
|
tableFacet, sampleMetaOfColumns, settings |
| 54 |
|
) |
| 55 |
|
.generateRowParams(); |
| 56 |
|
|
| 57 |
|
|
| 58 |
|
|
| 59 |
|
|
| 60 |
1 |
assertThat(testedRow.values()) |
| 61 |
|
.containsExactly("v1", 40, "v2"); |
| 62 |
|
|
| 63 |
|
} |
| 64 |
|
} |