/*
 * Copyright 2012 Google Inc. All Rights Reserved.
 *
 * 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.
 */

package com.google.errorprone.bugpatterns;

import com.google.errorprone.CompilationTestHelper;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;

/** @author yuan@ece.toronto.edu (Ding Yuan) */
@RunWith(JUnit4.class)
public class EmptyCatchTest {

  private CompilationTestHelper compilationHelper;

  @Before
  public void setUp() {
    compilationHelper = CompilationTestHelper.newInstance(EmptyCatch.class, getClass());
  }

  @Test
  public void testPositiveCase() throws Exception {
    compilationHelper.addSourceFile("EmptyCatchPositiveCases.java").doTest();
  }

  @Test
  public void testNegativeCase() throws Exception {
    compilationHelper.addSourceFile("EmptyCatchNegativeCases.java").doTest();
  }
}

@@ -1387,11 +1387,660 @@
 t();%0A  %7D
+%0A%0A  @Test%0A  public void addTestNgTest() %7B%0A    compilationHelper%0A        .addSourceLines(%0A            %22org/testng/annotations/Test.java%22,%0A            %22package org.testng.annotations;%22,%0A            %22public @interface Test %7B%22,%0A            %22%7D%22)%0A        .addSourceLines(%0A            %22in/SomeTest.java%22,%0A            %22import org.testng.annotations.Test;%22,%0A            %22public class SomeTest %7B%22,%0A            %22  @Test%22,%0A            %22  public void testNG() %7B%22,%0A            %22    try %7B%22,%0A            %22      System.err.println();%22,%0A            %22    %7D catch (Exception doNotCare) %7B%22,%0A            %22    %7D%22,%0A            %22  %7D%22,%0A            %22%7D%22)%0A        .doTest();%0A  %7D
 %0A%7D%0A

Add a test using testng for EmptyCatch check check was updated in http://https://github.com/google/error-prone/commit/888d2f0546b4317d3bae51b6f6b6fc6f7eb5ca3e