mirror of
https://github.com/tiennm99/java-design-patterns.git
synced 2026-05-20 05:27:15 +00:00
refactoring: reduce logs (#2370)
* feat: reduce logs from monitor pattern during test execution * fix: wait until all threads are done
This commit is contained in:
@@ -25,6 +25,7 @@
|
||||
package com.iluwatar.monitor;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
import java.util.concurrent.CountDownLatch;
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
|
||||
/** Test if the application starts without throwing an exception. */
|
||||
@@ -38,6 +39,9 @@ class MainTest {
|
||||
@Test
|
||||
void RunnerExecuteWithoutException() {
|
||||
var bank = new Bank(4, 1000);
|
||||
assertDoesNotThrow(() -> Main.runner(bank));
|
||||
var latch = new CountDownLatch(1);
|
||||
|
||||
assertDoesNotThrow(() -> Main.runner(bank, latch));
|
||||
assertEquals(0, latch.getCount());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
|
||||
The MIT License
|
||||
Copyright © 2014-2022 Ilkka Seppälä
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
|
||||
-->
|
||||
<configuration>
|
||||
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
|
||||
<encoder>
|
||||
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>
|
||||
</encoder>
|
||||
</appender>
|
||||
<root level="info">
|
||||
<appender-ref ref="STDOUT" />
|
||||
</root>
|
||||
</configuration>
|
||||
Reference in New Issue
Block a user