|
|
|
|
@ -1,5 +1,5 @@
@@ -1,5 +1,5 @@
|
|
|
|
|
/* |
|
|
|
|
* Copyright 2012-2024 the original author or authors. |
|
|
|
|
* Copyright 2012-2025 the original author or authors. |
|
|
|
|
* |
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License"); |
|
|
|
|
* you may not use this file except in compliance with the License. |
|
|
|
|
@ -31,6 +31,7 @@ import static org.assertj.core.api.Assertions.assertThatIllegalStateException;
@@ -31,6 +31,7 @@ import static org.assertj.core.api.Assertions.assertThatIllegalStateException;
|
|
|
|
|
* @author Andy Wilkinson |
|
|
|
|
* @author Phillip Webb |
|
|
|
|
* @author Scott Frederick |
|
|
|
|
* @author He Zean |
|
|
|
|
*/ |
|
|
|
|
class PostgresEnvironmentTests { |
|
|
|
|
|
|
|
|
|
@ -66,6 +67,20 @@ class PostgresEnvironmentTests {
@@ -66,6 +67,20 @@ class PostgresEnvironmentTests {
|
|
|
|
|
assertThat(environment.getUsername()).isEqualTo("me"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
|
void getUsernameWhenHasPostgresUsername() { |
|
|
|
|
PostgresEnvironment environment = new PostgresEnvironment( |
|
|
|
|
Map.of("POSTGRES_USERNAME", "me", "POSTGRESQL_PASSWORD", "secret")); |
|
|
|
|
assertThat(environment.getUsername()).isEqualTo("me"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
|
void getUsernameWhenHasPostgresqlUsername() { |
|
|
|
|
PostgresEnvironment environment = new PostgresEnvironment( |
|
|
|
|
Map.of("POSTGRESQL_USERNAME", "me", "POSTGRESQL_PASSWORD", "secret")); |
|
|
|
|
assertThat(environment.getUsername()).isEqualTo("me"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
|
void getPasswordWhenHasPostgresPassword() { |
|
|
|
|
PostgresEnvironment environment = new PostgresEnvironment(Map.of("POSTGRES_PASSWORD", "secret")); |
|
|
|
|
@ -104,6 +119,13 @@ class PostgresEnvironmentTests {
@@ -104,6 +119,13 @@ class PostgresEnvironmentTests {
|
|
|
|
|
assertThat(environment.getDatabase()).isEqualTo("me"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
|
void getDatabaseWhenNoPostgresqlDatabaseAndPostgresqlUsername() { |
|
|
|
|
PostgresEnvironment environment = new PostgresEnvironment( |
|
|
|
|
Map.of("POSTGRESQL_USERNAME", "me", "POSTGRESQL_PASSWORD", "secret")); |
|
|
|
|
assertThat(environment.getDatabase()).isEqualTo("me"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
|
void getDatabaseWhenHasPostgresDb() { |
|
|
|
|
PostgresEnvironment environment = new PostgresEnvironment( |
|
|
|
|
@ -112,9 +134,16 @@ class PostgresEnvironmentTests {
@@ -112,9 +134,16 @@ class PostgresEnvironmentTests {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
|
void getDatabaseWhenHasPostgresqlDb() { |
|
|
|
|
void getDatabaseWhenHasPostgresDatabase() { |
|
|
|
|
PostgresEnvironment environment = new PostgresEnvironment( |
|
|
|
|
Map.of("POSTGRES_DATABASE", "db", "POSTGRESQL_PASSWORD", "secret")); |
|
|
|
|
assertThat(environment.getDatabase()).isEqualTo("db"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
|
void getDatabaseWhenHasPostgresqlDatabase() { |
|
|
|
|
PostgresEnvironment environment = new PostgresEnvironment( |
|
|
|
|
Map.of("POSTGRESQL_DB", "db", "POSTGRESQL_PASSWORD", "secret")); |
|
|
|
|
Map.of("POSTGRESQL_DATABASE", "db", "POSTGRESQL_PASSWORD", "secret")); |
|
|
|
|
assertThat(environment.getDatabase()).isEqualTo("db"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|