/*
 * Copyright 2018 The Error Prone Authors.
 *
 * 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.nullness;

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

/** @author bhagwani@google.com (Sumit Bhagwani) */
@RunWith(JUnit4.class)
public class EqualsBrokenForNullTest {

  private CompilationTestHelper compilationHelper;

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

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

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

@@ -1394,11 +1394,553 @@
 t();%0A  %7D
+%0A%0A  @Test%0A  public void negativeGenerics() %7B%0A    compilationHelper%0A        .addSourceLines(%0A            %22Test.java%22,%0A            %22class Test%3CA, B%3E %7B%22,%0A            %22  A a;%22,%0A            %22  B b;%22,%0A            %22  public boolean equals(Object other) %7B%22,%0A            %22    if (!(other instanceof Test%3C?, ?%3E)) %7B%22,%0A            %22      return false;%22,%0A            %22    %7D%22,%0A            %22    Test%3C?, ?%3E that = (Test%3C?, ?%3E) other;%22,%0A            %22    return a.equals(that.a) && b.equals(that.b);%22,%0A            %22  %7D%22,%0A            %22%7D%22)%0A        .doTest();%0A  %7D
 %0A%7D%0A

Add a regression test for b/116048042 RELNOTES: N/A