class P2PathUtils {

  public static TokenMatcher.State matcherState(final Context context) {
    return context.getAttributes().require(TokenMatcher.State.class);
  }

}

class P2PathUtilsTest  {

  @Mock Context context;
  @Mock TokenMatcher.State state;
  @Mock AttributesMap attributesMap;
  private final String fakePath;
  private final String fakeComponentName;
  private final String fakeFileName;
  private final String fakeExtension;

  @Test
  public void matcherState() throws Exception {

    when(context.getAttributes())
        .thenReturn(attributesMap);
    when(attributesMap.require(TokenMatcher.State.class))
        .thenReturn(state);
    TokenMatcher.State testState = P2PathUtils.matcherState(context);
    assertThat(testState, instanceOf(TokenMatcher.State.class));
  }

}