working on messagesystem, password reset form

Signed-off-by: Stephan Richter <s.richter@srsoftware.de>
This commit is contained in:
2025-07-08 00:06:35 +02:00
parent 9d83008a62
commit 3e91565fb6
15 changed files with 337 additions and 67 deletions

View File

@@ -0,0 +1,30 @@
/* © SRSoftware 2025 */
import static java.lang.Thread.sleep;
import static org.junit.jupiter.api.Assertions.assertEquals;
import org.junit.jupiter.api.Test;
public class TriggerTest {
@Test
public void testSynchronization() throws InterruptedException {
StringBuffer sb = new StringBuffer();
new Thread(() -> writeTo(sb,"A")).start();
sleep(100);
new Thread(() -> writeTo(sb,"B")).start();
sleep(100);
new Thread(() -> writeTo(sb,"C")).start();
sleep(1000);
assertEquals("AABBCC",sb.toString());
}
private synchronized void writeTo(StringBuffer sb, String mark) {
sb.append(mark);
try {
sleep(200);
} catch (InterruptedException ignored) {}
sb.append(mark);
}
}