コード例 #1
0
ファイル: ViewsTest.java プロジェクト: jorispz/sonar
  @Test
  public void should_check_resource_scope() {
    ViewProxy proxy = mock(ViewProxy.class);
    assertThat(Views.acceptResourceScope(proxy, Scopes.FILE)).isEqualTo(true);

    when(proxy.getResourceScopes()).thenReturn(new String[] {Scopes.PROJECT, Scopes.FILE});
    assertThat(Views.acceptResourceScope(proxy, Scopes.FILE)).isEqualTo(true);
    assertThat(Views.acceptResourceScope(proxy, Scopes.DIRECTORY)).isEqualTo(false);
  }
コード例 #2
0
ファイル: ViewsTest.java プロジェクト: ricesorry/sonar
  @Test
  public void checkResourceScope() {
    ViewProxy proxy = mock(ViewProxy.class);
    assertThat(Views.acceptResourceScope(proxy, Scopes.FILE), is(true));

    when(proxy.getResourceScopes()).thenReturn(new String[] {Scopes.PROJECT, Scopes.FILE});
    assertThat(Views.acceptResourceScope(proxy, Scopes.FILE), is(true));
    assertThat(Views.acceptResourceScope(proxy, Scopes.DIRECTORY), is(false));
  }