类java.nio.file.attribute.UserPrincipalNotFoundException源码实例Demo

下面列出了怎么用java.nio.file.attribute.UserPrincipalNotFoundException的API类实例代码及写法,或者点击链接到github查看源代码。

@Test
public void testGetters() throws Exception {
    final String name = "foobar";
    UserPrincipalNotFoundException upnfException =
        new UserPrincipalNotFoundException(name);
    assertEquals(name, upnfException.getName());
}
 
源代码2 项目: jimfs   文件: UserLookupService.java
@Override
public GroupPrincipal lookupPrincipalByGroupName(String group) throws IOException {
  if (!supportsGroups) {
    throw new UserPrincipalNotFoundException(group); // required by spec
  }
  return createGroupPrincipal(group);
}
 
源代码3 项目: jimfs   文件: UserLookupServiceTest.java
@Test
public void testServiceNotSupportingGroups() throws IOException {
  UserPrincipalLookupService service = new UserLookupService(false);

  try {
    service.lookupPrincipalByGroupName("group");
    fail();
  } catch (UserPrincipalNotFoundException expected) {
    assertThat(expected.getName()).isEqualTo("group");
  }
}
 
 类所在包
 类方法
 同包方法