|
33 | 33 | import static org.junit.Assert.assertEquals; |
34 | 34 |
|
35 | 35 | public class RedshiftEnvironmentPropertiesTest { |
36 | | - Map<String, String> connectionProperties; |
37 | | - RedshiftEnvironmentProperties redshiftEnvironmentProperties; |
| 36 | + private static final String TEST_HOST = "redshift-cluster-endpoint"; |
| 37 | + private static final String TEST_DATABASE = "testdb"; |
| 38 | + private static final String TEST_SECRET = "redshift-secret"; |
| 39 | + private static final String TEST_PORT = "5436"; |
| 40 | + private static final String EXPECTED_CONNECTION_STRING = "redshift://jdbc:redshift://redshift-cluster-endpoint:5436/testdb?${redshift-secret}"; |
| 41 | + |
| 42 | + private Map<String, String> connectionProperties; |
| 43 | + private RedshiftEnvironmentProperties redshiftEnvironmentProperties; |
38 | 44 |
|
39 | 45 | @Before |
40 | 46 | public void setUp() { |
41 | 47 | connectionProperties = new HashMap<>(); |
42 | | - connectionProperties.put(HOST, "redshift-cluster-endpoint"); |
43 | | - connectionProperties.put(DATABASE, "testdb"); |
44 | | - connectionProperties.put(SECRET_NAME, "redshift-secret"); |
45 | | - connectionProperties.put(PORT, "5436"); |
| 48 | + connectionProperties.put(HOST, TEST_HOST); |
| 49 | + connectionProperties.put(DATABASE, TEST_DATABASE); |
| 50 | + connectionProperties.put(SECRET_NAME, TEST_SECRET); |
| 51 | + connectionProperties.put(PORT, TEST_PORT); |
46 | 52 | redshiftEnvironmentProperties = new RedshiftEnvironmentProperties(); |
47 | 53 | } |
48 | 54 |
|
49 | 55 | @Test |
50 | 56 | public void redshiftConnectionPropertiesTest() { |
51 | | - |
52 | 57 | Map<String, String> redshiftConnectionProperties = redshiftEnvironmentProperties.connectionPropertiesToEnvironment(connectionProperties); |
53 | 58 |
|
54 | | - String expectedConnectionString = "redshift://jdbc:redshift://redshift-cluster-endpoint:5436/testdb?${redshift-secret}"; |
55 | | - assertEquals(expectedConnectionString, redshiftConnectionProperties.get(DEFAULT)); |
| 59 | + assertEquals(EXPECTED_CONNECTION_STRING, redshiftConnectionProperties.get(DEFAULT)); |
56 | 60 | } |
57 | 61 | } |
0 commit comments