// Path: src/main/java/de/thetaphi/forbiddenapis/Checker.java
// public static enum Option {
//   FAIL_ON_MISSING_CLASSES,
//   FAIL_ON_VIOLATION,
//   FAIL_ON_UNRESOLVABLE_SIGNATURES,
//   IGNORE_SIGNATURES_OF_MISSING_CLASSES,
//   DISABLE_CLASSLOADING_CACHE
// }


import static de.thetaphi.forbiddenapis.Checker.Option.*;
import static org.junit.Assert.*;
import static org.junit.Assume.assumeTrue;
import static org.junit.Assume.assumeNoException;
import java.util.Collections;
import java.util.EnumSet;
import org.junit.Before;
import org.junit.Test;
import org.objectweb.asm.commons.Method;
  }

  @Test
  public void testMethodSignature() throws Exception {
    checker.parseSignaturesString("java.lang.Object#toString() @ Foobar");
    assertEquals(Collections.singletonMap(Signatures.getKey("java/lang/Object", new Method("toString", "()Ljava/lang/String;")), "java.lang.Object#toString() [Foobar]"),
        forbiddenSignatures.signatures);
    assertEquals(Collections.emptySet(), forbiddenSignatures.classPatterns);
    assertFalse(checker.hasNoSignatures());
    assertFalse(checker.noSignaturesFilesParsed());
  }
  
  @Test
  public void testMethodSignatureWS() throws Exception {
    checker.parseSignaturesString("java.lang.Object# toString\t ( ) @ Foobar");
    assertEquals(Collections.singletonMap(Signatures.getKey("java/lang/Object", new Method("toString", "()Ljava/lang/String;")), "java.lang.Object# toString\t ( ) [Foobar]"),
        forbiddenSignatures.signatures);
    assertEquals(Collections.emptySet(), forbiddenSignatures.classPatterns);
    assertFalse(checker.hasNoSignatures());
    assertFalse(checker.noSignaturesFilesParsed());
  }
  
  @Test
  public void testWildcardMethodSignature() throws Exception {
    checker.parseSignaturesString("java.lang.String#copyValueOf(**) @ Foobar");
    
    // For Java 7 it should at least contain those 2 signatures:
    assertTrue(forbiddenSignatures.signatures.containsKey(Signatures.getKey("java/lang/String", new Method("copyValueOf", "([C)Ljava/lang/String;"))));
    assertTrue(forbiddenSignatures.signatures.containsKey(Signatures.getKey("java/lang/String", new Method("copyValueOf", "([CII)Ljava/lang/String;"))));
    
// Path: src/main/java/de/thetaphi/forbiddenapis/Checker.java
// public static enum Option {
//   FAIL_ON_MISSING_CLASSES,
//   FAIL_ON_VIOLATION,
//   FAIL_ON_UNRESOLVABLE_SIGNATURES,
//   IGNORE_SIGNATURES_OF_MISSING_CLASSES,
//   DISABLE_CLASSLOADING_CACHE
// }


// Path: src/test/java/de/thetaphi/forbiddenapis/CheckerSetupTest.java
import static de.thetaphi.forbiddenapis.Checker.Option.*;
import static org.junit.Assert.*;
import static org.junit.Assume.assumeTrue;
import static org.junit.Assume.assumeNoException;
import java.util.Collections;
import java.util.EnumSet;
import org.junit.Before;
import org.junit.Test;
import org.objectweb.asm.commons.Method;

  }

  @Test
  public void testMethodSignature() throws Exception {
    checker.parseSignaturesString("java.lang.Object#toString() @ Foobar");
    assertEquals(Collections.singletonMap(Signatures.getKey("java/lang/Object", new Method("toString", "()Ljava/lang/String;")), "java.lang.Object#toString() [Foobar]"),
        forbiddenSignatures.signatures);
    assertEquals(Collections.emptySet(), forbiddenSignatures.classPatterns);
    assertFalse(checker.hasNoSignatures());
    assertFalse(checker.noSignaturesFilesParsed());
  }
  
  @Test
  public void testMethodSignatureWS() throws Exception {
    checker.parseSignaturesString("java.lang.Object# toString\t ( ) @ Foobar");
    assertEquals(Collections.singletonMap(Signatures.getKey("java/lang/Object", new Method("toString", "()Ljava/lang/String;")), "java.lang.Object# toString\t ( ) [Foobar]"),
        forbiddenSignatures.signatures);
    assertEquals(Collections.emptySet(), forbiddenSignatures.classPatterns);
    assertFalse(checker.hasNoSignatures());
    assertFalse(checker.noSignaturesFilesParsed());
  }
  
  @Test
  public void testWildcardMethodSignature() throws Exception {
    checker.parseSignaturesString("java.lang.String#copyValueOf(**) @ Foobar");
    
    // For Java 7 it should at least contain those 2 signatures:
    assertTrue(forbiddenSignatures.signatures.containsKey(Signatures.getKey("java/lang/String", new Method("copyValueOf", "([C)Ljava/lang/String;"))));
    assertTrue(forbiddenSignatures.signatures.containsKey(Signatures.getKey("java/lang/String", new Method("copyValueOf", "([CII)Ljava/lang/String;"))));
    
    assertEquals(Collections.emptySet(), forbiddenSignatures.classPatterns);