// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.siyeh.ig.classlayout;

import com.intellij.codeInspection.InspectionProfileEntry;
import com.siyeh.ig.LightJavaInspectionTestCase;
import org.jetbrains.annotations.Nullable;

public class ClassWithOnlyPrivateConstructorsInspectionTest extends LightJavaInspectionTestCase {

  public void testSimple() {
    doTest("final class /*Class 'X' with only 'private' constructors should be declared 'final'*/X/**/ {" +
           "  private X() {}" +
           "  private X(int i) {}" +
           "}");
  }

  public void testExtendingInnerClass() {
    doTest("final class X {\n" +
           "  private X() {}\n" +
           "  class Y {\n" +
           "    class Z extends X{}\n" +
           "  }\n" +
           "}");
  }

  public void testNoConstructors() {
    doTest("class X {}");
  }

  public void testNoWarnOnFinalClass() {
    doTest("final class X {" +
           "  private X() {}" +
           "}");
  }

  public void testNoWarnOnAnonymInheritor() {
    doTest("final class X {" +
           "  private X() {}" +
           "  static {new X() {};} " +
           "}");
  }

  public void testEnum() {
    //noinspection UnnecessaryEnumModifier
    doTest("enum Currencies {\n" +
           "    EURO, DOLLAR;\n" +
           "    private Currencies() {\n" +
           "    }\n" +
           "}");
  }

  public void testPublicConstructor() {
    doTest("class A {" +
           "  public A() {}" +
           "}");
  }

  public void testSubclassInSameFile() {
    doTest("class Test {" +
           "    private static final class Inner {" +
           "        private Inner() {}" +
           "    }" +
           "    private static class InnerSub extends Inner {}" +
           "}");
  }

  @Nullable
  @Override
  protected InspectionProfileEntry getInspection() {
    return new ClassWithOnlyPrivateConstructorsInspection();
  }
}
@@ -457,30 +457,24 @@
     doTest(%22
-final 
 class /*Clas
@@ -547,24 +547,24 @@
 /X/**/ %7B%22 +%0A
+
            %22
@@ -688,38 +688,32 @@
 ) %7B%0A    doTest(%22
-final 
 class X %7B%5Cn%22 +%0A 
@@ -1102,38 +1102,32 @@
 ) %7B%0A    doTest(%22
-final 
 class X %7B%22 +%0A   
@@ -1628,24 +1628,24 @@
 s Test %7B%22 +%0A
+
            %22
@@ -1663,22 +1663,16 @@
  static 
-final 
 class In

fix ClassWithOnlyPrivateConstructorsInspectionTest