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

File PostgresTest.java

 

Code metrics

0
3
3
1
57
44
3
1
1
3
1

Classes

Class Line # Actions
PostgresTest 21 3 0% 3 6
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   
5    import org.springframework.beans.factory.annotation.Autowired;
6    import org.springframework.context.ApplicationContext;
7    import org.springframework.jdbc.core.JdbcTemplate;
8    import org.springframework.transaction.annotation.Transactional;
9   
10    import org.junit.jupiter.api.BeforeAll;
11    import org.junit.jupiter.api.Tag;
12    import org.junit.jupiter.api.Test;
13   
14    import guru.mikelue.foxglove.TableFacet;
15    import guru.mikelue.foxglove.annotation.GenData;
16    import guru.mikelue.foxglove.annotation.TableFacetsSource;
17    import guru.mikelue.foxglove.jdbc.JdbcTableFacet;
18    import guru.mikelue.foxglove.test.AbstractVendorTestBase;
19   
20    @Tag("vendor-postgres")
 
21    public class PostgresTest extends AbstractVendorTestBase {
22    private final static int RANDOM_ROWS = gen().ints().range(10, 20).get();
23   
 
24  0 toggle public PostgresTest() {}
25   
 
26  0 toggle @BeforeAll
27    static void beforeAllSetup(
28    @Autowired ApplicationContext appContext,
29    @Autowired JdbcTemplate jdbcTemplate
30    ) throws IOException {
31  0 dropTables(jdbcTemplate, "ap_types");
32   
33  0 build("classpath:postgres-types.sql", appContext);
34    }
35   
36    @TableFacetsSource
37    TableFacet defaultData = JdbcTableFacet.builder("ap_types")
38    .numberOfRows(RANDOM_ROWS)
39    .column("tp_color").fixed("green")
40    .column("tp_dimension").fixed(new Integer[] {1, 2, 3, 4})
41    .column("tp_range").fixed("[1,10]")
42    .column("tp_json_data").fixed("[2, 4, 6, 8, 10]")
43    .build();
44   
45    /**
46    * Tests basic functionality of Postgres database.
47    */
 
48  0 toggle @Test
49    @GenData @Transactional
50    void basic()
51    {
52  0 assertNumberOfRows(
53    "ap_types", "tp_color = 'green'"
54    )
55    .isEqualTo(RANDOM_ROWS);
56    }
57    }