File tree Expand file tree Collapse file tree 1 file changed +24
-0
lines changed
dongtai-log/src/test/java/io.dongtai.log Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -9,6 +9,10 @@ public class IastPropertiesTest {
99 private final String oldLogPath = System .getProperty ("dongtai.log.path" );
1010 private final String LogLevel = System .getProperty ("dongtai.log.level" );
1111
12+ private final String switchSign = System .getProperty ("dongtai.log" );
13+
14+
15+
1216 @ Before
1317 public void setUp () {
1418 clear ();
@@ -26,12 +30,32 @@ public void tearDown() {
2630 if (LogLevel != null ) {
2731 System .setProperty ("dongtai.log.level" , LogLevel );
2832 }
33+ if (switchSign != null ) {
34+ System .setProperty ("dongtai.log" , switchSign );
35+ }
2936 }
3037
3138 private void clear () {
3239 System .clearProperty ("java.io.tmpdir.dongtai" );
3340 System .clearProperty ("dongtai.log.path" );
3441 System .clearProperty ("dongtai.log.level" );
42+ System .clearProperty ("dongtai.log" );
43+ }
44+
45+
46+ @ Test
47+ public void isEnabledTest (){
48+ boolean enabled = IastProperties .isEnabled ();
49+ //默认开启
50+ Assert .assertTrue ("isEnabled:" + enabled , enabled );
51+
52+
53+ //修改为关闭
54+ System .setProperty ("dongtai.log" , "false" );
55+ enabled = IastProperties .isEnabled ();
56+ Assert .assertFalse ("isEnabled:" + enabled ,enabled );
57+
58+
3559 }
3660
3761 @ Test
You can’t perform that action at this time.
0 commit comments