@Test
  public void testGetAnnotationTargetWrongArg() throws ReflectiveOperationException {
    final SuppressWarningsHolder holder = new SuppressWarningsHolder();
    final Method getAnnotationTarget =
        holder.getClass().getDeclaredMethod("getAnnotationTarget", DetailAST.class);
    getAnnotationTarget.setAccessible(true);

    final DetailAST methodDef = new DetailAST();
    methodDef.setType(TokenTypes.METHOD_DEF);
    methodDef.setText("Method Def");

    final DetailAST parent = new DetailAST();
    parent.setType(TokenTypes.ASSIGN);
    parent.setText("Parent ast");
    parent.addChild(methodDef);
    parent.setLineNo(0);
    parent.setColumnNo(0);

    try {
      getAnnotationTarget.invoke(holder, methodDef);
      fail("Exception expected");
    } catch (InvocationTargetException ex) {
      assertTrue(ex.getCause() instanceof IllegalArgumentException);
      assertEquals("Unexpected container AST: Parent ast[0x0]", ex.getCause().getMessage());
    }
  }
  @Test
  public void testIsSuppressed() throws Exception {
    final Class<?> entry =
        Class.forName("com.puppycrawl.tools.checkstyle.checks.SuppressWarningsHolder$Entry");
    final Constructor<?> entryConstructor =
        entry.getDeclaredConstructor(String.class, int.class, int.class, int.class, int.class);
    entryConstructor.setAccessible(true);

    final Object entryInstance = entryConstructor.newInstance("MockEntry", 100, 100, 350, 350);

    final List<Object> entriesList = new ArrayList<>();
    entriesList.add(entryInstance);

    final ThreadLocal<?> threadLocal = mock(ThreadLocal.class);
    PowerMockito.doReturn(entriesList).when(threadLocal, "get");

    final SuppressWarningsHolder holder = new SuppressWarningsHolder();
    final Field entries = holder.getClass().getDeclaredField("ENTRIES");
    entries.setAccessible(true);
    entries.set(holder, threadLocal);

    final Checker source = new Checker();
    final LocalizedMessage message =
        new LocalizedMessage(100, 10, null, null, null, "id", MemberNameCheck.class, "message");
    final AuditEvent event = new AuditEvent(source, "fileName", message);

    assertFalse(SuppressWarningsHolder.isSuppressed(event));
  }
  @Test
  public void testGetAnnotationValuesWrongArg() throws ReflectiveOperationException {
    final SuppressWarningsHolder holder = new SuppressWarningsHolder();
    final Method getAllAnnotationValues =
        holder.getClass().getDeclaredMethod("getAnnotationValues", DetailAST.class);
    getAllAnnotationValues.setAccessible(true);

    final DetailAST methodDef = new DetailAST();
    methodDef.setType(TokenTypes.METHOD_DEF);
    methodDef.setText("Method Def");
    methodDef.setLineNo(0);
    methodDef.setColumnNo(0);

    try {
      getAllAnnotationValues.invoke(holder, methodDef);
      fail("Exception expected");
    } catch (InvocationTargetException ex) {
      assertTrue(ex.getCause() instanceof IllegalArgumentException);
      assertEquals(
          "Expression or annotation array" + " initializer AST expected: Method Def[0x0]",
          ex.getCause().getMessage());
    }
  }