package com.episode6.hackit.chop;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;

import static org.mockito.Matchers.any;
import static org.mockito.Matchers.anyString;
import static org.mockito.Matchers.eq;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;

@RunWith(ChopTestTestRunner.class)
public class DefaultTaggerTest {

  @Mock Chop.Tree mTree;

  @Before
  public void setUp() {
    when(mTree.supportsLevel(any(Chop.Level.class)))
        .thenReturn(true);

    Chop.plantTree(mTree);
  }

  @Test
  public void testOuterClass() {

    String expectedTag = DefaultTaggerTest.class.getSimpleName();

    Chop.d("Test Message");

    verify(mTree).chopLog(
        any(Chop.Level.class),
        eq(expectedTag),
        anyString()
    );
  }

  @After
  public void cleanUp() {
    ChopInternals.TREE_FARM.digUpTree(mTree);
  }
}

@@ -650,17 +650,16 @@
 ass() %7B%0A
-%0A
     Stri
@@ -861,16 +861,361 @@
 );%0A  %7D%0A%0A
+  @Test%0A  public void testAnonymousClass() %7B%0A    String expectedTag = DefaultTaggerTest.class.getSimpleName();%0A%0A    new Runnable() %7B%0A%0A      @Override%0A      public void run() %7B%0A        Chop.d(%22Test message%22);%0A      %7D%0A    %7D.run();%0A%0A    verify(mTree).chopLog(%0A        any(Chop.Level.class),%0A        eq(expectedTag),%0A        anyString()%0A    );%0A  %7D%0A%0A
   @After

add a test for anonymous inner classes