View Javadoc
1   /*
2    * MIT License
3    * Copyright (c) 2006-2025 JMockit developers
4    * See LICENSE file for full license text.
5    */
6   package integration.tests.other.control.structures;
7   
8   import org.junit.jupiter.api.Assertions;
9   import org.junit.jupiter.api.Test;
10  
11  class SynchronizedBlocksTest {
12      private final SynchronizedBlocks tested = new SynchronizedBlocks();
13  
14      @Test
15      void doInSynchronizedBlock() {
16          tested.doInSynchronizedBlock();
17      }
18  
19      @Test
20      void doInSynchronizedBlockWithTrue() {
21          tested.doInSynchronizedBlockWithParameter(true);
22      }
23  
24      @Test
25      void doInSynchronizedBlockWithFalse() {
26          Assertions.assertThrows(RuntimeException.class, () -> {
27              tested.doInSynchronizedBlockWithParameter(false);
28          });
29      }
30  }