/* Copyright (c) 2010 Google Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

/**
 * @author Sergey Vorobyev
 */
public class CustomTests {

  static class staticFinalProvider {
    private static final int x = 42;
    static int getX() {
      return x;
    }
  }

  @RaceTest(expectRace = false,
      description = "Static final variable init and access")
  public void staticFinal() {
    new ThreadRunner(4) {
      public void thread1() {
        shortSleep();
        int z = staticFinalProvider.getX();
      }
      public void thread2() {
        thread1();
      }
      public void thread3() {
        thread1();
      }
      public void thread4() {
        thread1();
      }
    };
  }
}

@@ -1213,10 +1213,391 @@
  %7D;%0A  %7D%0A
+%0A  @RaceTest(expectRace = false,%0A      description = %22Stop thread by throwing Exception%22)%0A  public void exceptionExit() %7B%0A    new ThreadRunner(2) %7B%0A      public synchronized void thread1() %7B%0A        sharedVar++;%0A        throw new RuntimeException(%22Exit from thread1 with this Exception%22);%0A      %7D%0A      public synchronized void thread2() %7B%0A        sharedVar++;%0A      %7D%0A    %7D;%0A  %7D%0A%0A
 %7D%0A

add exceptionExit test