1. Project Clover database Wed Nov 12 2025 05:07:35 UTC
  2. Package guru.mikelue.foxglove.vendor

File DerbyTest.java

 

Code metrics

0
3
4
1
71
57
4
1.33
0.75
4
1

Classes

Class Line # Actions
DerbyTest 25 3 0% 4 7
0.00%
 

Contributing tests

No tests hitting this source file were found.

Source view

1    package guru.mikelue.foxglove.vendor;
2   
3    import java.io.IOException;
4    import java.sql.JDBCType;
5   
6    import org.springframework.beans.factory.annotation.Autowired;
7    import org.springframework.context.ApplicationContext;
8    import org.springframework.jdbc.core.JdbcTemplate;
9    import org.springframework.test.jdbc.JdbcTestUtils;
10    import org.springframework.transaction.annotation.Transactional;
11   
12    import org.junit.jupiter.api.AfterAll;
13    import org.junit.jupiter.api.BeforeAll;
14    import org.junit.jupiter.api.Tag;
15    import org.junit.jupiter.api.Test;
16   
17    import guru.mikelue.foxglove.TableFacet;
18    import guru.mikelue.foxglove.annotation.GenData;
19    import guru.mikelue.foxglove.annotation.TableFacetsSource;
20    import guru.mikelue.foxglove.jdbc.JdbcTableFacet;
21    import guru.mikelue.foxglove.setting.DataSetting;
22    import guru.mikelue.foxglove.test.AbstractVendorTestBase;
23   
24    @Tag("vendor-derby")
 
25    public class DerbyTest extends AbstractVendorTestBase {
26    private final static int RANDOM_ROWS = gen().ints().range(5, 10).get();
27   
 
28  0 toggle public DerbyTest() {}
29   
 
30  0 toggle @BeforeAll
31    static void beforeAllSetup(
32    @Autowired ApplicationContext appContext,
33    @Autowired JdbcTemplate jdbcTemplate
34    ) throws IOException {
35  0 build("classpath:derby-types.sql", appContext);
36    }
37   
 
38  0 toggle @AfterAll
39    static void afterAllTearDown(
40    @Autowired ApplicationContext appContext,
41    @Autowired JdbcTemplate jdbcTemplate
42    ) throws IOException {
43  0 JdbcTestUtils.dropTables(jdbcTemplate, "ap_types");
44    }
45   
46    private DataSetting derbyTyping = new DataSetting()
47    .givenType(JDBCType.TIMESTAMP)
48    .useSupplier(() -> gen().temporal().timestamp().get());
49   
50    @TableFacetsSource
51    TableFacet defaultData = JdbcTableFacet.builder("ap_types")
52    .withSetting(
53    derbyTyping
54    )
55    .numberOfRows(RANDOM_ROWS)
56    .column("tp_color").fixed("green")
57    .build();
58   
59    /**
60    * Tests basic functionality of Derby database.
61    */
 
62  0 toggle @Test
63    @GenData @Transactional
64    void basic()
65    {
66  0 assertNumberOfRows(
67    "ap_types", "tp_color = 'green'"
68    )
69    .isEqualTo(RANDOM_ROWS);
70    }
71    }