Skip to content

Commit c52f347

Browse files
committed
feature : method for PropertiesLoggerTest.java
1 parent 8c1fc91 commit c52f347

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
package fr.insee.rmes.config;
2+
3+
import org.junit.jupiter.api.Test;
4+
import org.springframework.boot.DefaultBootstrapContext;
5+
import org.springframework.boot.SpringApplication;
6+
import org.springframework.boot.context.event.ApplicationEnvironmentPreparedEvent;
7+
import org.springframework.core.env.ConfigurableEnvironment;
8+
import org.springframework.core.env.StandardEnvironment;
9+
import static org.junit.jupiter.api.Assertions.assertEquals;
10+
11+
class PropertiesLoggerTest {
12+
13+
@Test
14+
void shouldVerifyStateAndTestResoutValeurAvecMasquePwdWhenOnApplicationEvent() {
15+
DefaultBootstrapContext defaultBootstrapContext = new DefaultBootstrapContext();
16+
SpringApplication springApplication = new SpringApplication();
17+
String[] args = {"password", "World"};
18+
ConfigurableEnvironment configurableEnvironment = new StandardEnvironment();
19+
ApplicationEnvironmentPreparedEvent environment = new ApplicationEnvironmentPreparedEvent(defaultBootstrapContext,springApplication,args,configurableEnvironment);
20+
21+
PropertiesLogger propertiesLogger = new PropertiesLogger();
22+
String save = propertiesLogger.toString();
23+
propertiesLogger.onApplicationEvent(environment);
24+
String after = propertiesLogger.toString();
25+
26+
assertEquals(save,after);
27+
28+
}
29+
}

0 commit comments

Comments
 (0)