Esempio n. 1
0
  @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);
  }
Esempio n. 2
0
  @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));
  }