gpt4 book ai didi

org.springframework.test.web.servlet.result.XpathResultMatchers.doesNotExist()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-21 01:07:05 26 4
gpt4 key购买 nike

本文整理了Java中org.springframework.test.web.servlet.result.XpathResultMatchers.doesNotExist()方法的一些代码示例,展示了XpathResultMatchers.doesNotExist()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。XpathResultMatchers.doesNotExist()方法的具体详情如下:
包路径:org.springframework.test.web.servlet.result.XpathResultMatchers
类名称:XpathResultMatchers
方法名:doesNotExist

XpathResultMatchers.doesNotExist介绍

[英]Evaluate the XPath and assert that content doesn't exist.
[中]评估XPath并断言内容不存在。

代码示例

代码示例来源:origin: spring-projects/spring-framework

@Test
public void testDoesNotExist() throws Exception {
  String composer = "/ns:people/composers/composer[%s]";
  String performer = "/ns:people/performers/performer[%s]";
  this.mockMvc.perform(get("/music/people"))
    .andExpect(xpath(composer, musicNamespace, 0).doesNotExist())
    .andExpect(xpath(composer, musicNamespace, 5).doesNotExist())
    .andExpect(xpath(performer, musicNamespace, 0).doesNotExist())
    .andExpect(xpath(performer, musicNamespace, 3).doesNotExist())
    .andExpect(xpath(composer, musicNamespace, 0).node(nullValue()));
}

代码示例来源:origin: spring-projects/spring-framework

@Test(expected = AssertionError.class)
public void doesNotExistNoMatch() throws Exception {
  new XpathResultMatchers("/foo/bar", null).doesNotExist().match(getStubMvcResult());
}

代码示例来源:origin: spring-projects/spring-framework

@Test
public void doesNotExist() throws Exception {
  new XpathResultMatchers("/foo/Bar", null).doesNotExist().match(getStubMvcResult());
}

代码示例来源:origin: cloudfoundry/uaa

@Test
public void testAcceptInvitePageWithExpiredCode() throws Exception {
  when(expiringCodeStore.retrieveCode(anyString(), eq(IdentityZoneHolder.get().getId()))).thenReturn(null);
  MockHttpServletRequestBuilder get = get("/invitations/accept").param("code", "the_secret_code");
  mockMvc.perform(get)
    .andExpect(status().isUnprocessableEntity())
    .andExpect(model().attribute("error_message_code", "code_expired"))
    .andExpect(view().name("invitations/accept_invite"))
    .andExpect(xpath("//*[@class='email-display']").doesNotExist())
    .andExpect(xpath("//form").doesNotExist());
  assertNull(SecurityContextHolder.getContext().getAuthentication());
}

代码示例来源:origin: cloudfoundry/uaa

@Test
void testSignupsAndResetPasswordDisabledWithNoLinksConfigured() throws Exception {
  MockMvcUtils.setSelfServiceLinksEnabled(webApplicationContext, getUaa().getId(), false);
  mockMvc.perform(MockMvcRequestBuilders.get("/login"))
      .andExpect(xpath("//a[text()='Create account']").doesNotExist())
      .andExpect(xpath("//a[text()='Reset password']").doesNotExist());
}

代码示例来源:origin: cloudfoundry/uaa

@Test
  void resetPasswordNotEnabled() throws Exception {
    mockMvc.perform(get("/login"))
        .andExpect(status().isOk())
        .andExpect(xpath("//a[@href='/forgot_password']").doesNotExist());
  }
}

代码示例来源:origin: cloudfoundry/uaa

@Test
void createAccountNotEnabled() throws Exception {
  mockMvc.perform(get("/login"))
      .andExpect(status().isOk())
      .andExpect(xpath("//a[@href='/create_account']").doesNotExist());
}

代码示例来源:origin: cloudfoundry/uaa

@Test
void testSignupsAndResetPasswordDisabledWithSomeLinksConfigured() throws Exception {
  identityZoneConfiguration.getLinks().getSelfService().setSignup("http://example.com/signup");
  identityZoneConfiguration.getLinks().getSelfService().setPasswd("http://example.com/reset_passwd");
  identityZoneConfiguration.getLinks().getSelfService().setSelfServiceLinksEnabled(false);
  MockMvcUtils.setZoneConfiguration(webApplicationContext, getUaa().getId(), identityZoneConfiguration);
  mockMvc.perform(MockMvcRequestBuilders.get("/login"))
      .andExpect(xpath("//a[text()='Create account']").doesNotExist())
      .andExpect(xpath("//a[text()='Reset password']").doesNotExist());
}

代码示例来源:origin: cloudfoundry/uaa

@Test
void emailPageIdpDiscoveryEnabled_SelfServiceLinksDisabled(
    @Autowired IdentityZoneProvisioning identityZoneProvisioning
) throws Exception {
  IdentityZoneConfiguration config = new IdentityZoneConfiguration();
  config.setIdpDiscoveryEnabled(true);
  config.setLinks(new Links().setSelfService(new Links.SelfService().setSelfServiceLinksEnabled(false)));
  IdentityZone zone = setupZone(webApplicationContext, mockMvc, identityZoneProvisioning, generator, config);
  MockMvcUtils.setSelfServiceLinksEnabled(webApplicationContext, getUaa().getId(), false);
  mockMvc.perform(MockMvcRequestBuilders.get("/login")
      .with(new SetServerNameRequestPostProcessor(zone.getSubdomain() + ".localhost")))
      .andExpect(xpath("//div[@class='action']//a").doesNotExist());
}

代码示例来源:origin: cloudfoundry/uaa

@Test
public void tilesFromClientMetadataAndTilesConfigShown() throws Exception {
  mockMvc.perform(get("/"))
    .andExpect(xpath("//*[@id='tile-1'][text()[contains(.,'client-1')]]").exists())
    .andExpect(xpath("//*[@class='tile-1']/@href").string("http://app.launch/url"))
    .andExpect(xpath("//head/style[2]").string(".tile-1 .tile-icon {background-image: url(\"data:image/png;base64," + base64EncodedImg + "\")}"))
    .andExpect(xpath("//*[@id='tile-2'][text()[contains(.,'Client 2 Name')]]").exists())
    .andExpect(xpath("//*[@class='tile-2']/@href").string("http://second.url/"))
    .andExpect(xpath("//*[@class='tile-3']").doesNotExist());
}

代码示例来源:origin: cloudfoundry/uaa

@Test
public void tilesFromClientMetadataAndTilesConfigShown_forOtherZone() throws Exception {
  IdentityZone identityZone = MultitenancyFixture.identityZone("test", "test");
  IdentityZoneHolder.set(identityZone);
  mockMvc.perform(get("/"))
    .andExpect(xpath("//*[@id='tile-1'][text()[contains(.,'client-1')]]").exists())
    .andExpect(xpath("//*[@class='tile-1']/@href").string("http://app.launch/url"))
    .andExpect(xpath("//head/style[1]").string(".tile-1 .tile-icon {background-image: url(\"data:image/png;base64," + base64EncodedImg + "\")}"))
    .andExpect(xpath("//*[@id='tile-2'][text()[contains(.,'Client 2 Name')]]").exists())
    .andExpect(xpath("//*[@class='tile-2']/@href").string("http://second.url/"))
    .andExpect(xpath("//*[@class='tile-3']").doesNotExist());
}

代码示例来源:origin: cloudfoundry/uaa

@Test
void passwordPageIdpDiscoveryEnabled_SelfServiceLinksDisabled() throws Exception {
  MockMvcUtils.setSelfServiceLinksEnabled(webApplicationContext, getUaa().getId(), false);
  mockMvc.perform(post("/login/idp_discovery")
      .with(cookieCsrf())
      .header("Accept", TEXT_HTML)
      .param("email", "marissa@koala.org"))
      .andExpect(status().isFound())
      .andExpect(redirectedUrl("/login?discoveryPerformed=true&email=marissa%40koala.org"));
  mockMvc.perform(get("/login?discoveryPerformed=true&email=marissa%40koala.org")
      .with(cookieCsrf())
      .header("Accept", TEXT_HTML))
      .andExpect(status().isOk())
      .andExpect(xpath("//div[@class='action pull-right']//a").doesNotExist());
}

代码示例来源:origin: cloudfoundry/uaa

.with(new SetServerNameRequestPostProcessor(identityZone.getSubdomain() + ".localhost")))
.andExpect(status().isOk())
.andExpect(xpath("//a[text()='Create account']").doesNotExist())
.andExpect(xpath("//a[text()='Reset password']").doesNotExist());

代码示例来源:origin: cloudfoundry/uaa

.andExpect(status().isOk())
.andExpect(xpath("//a[text()='" + activeSamlIdentityProviderDefinition.getLinkText() + "']").exists())
.andExpect(xpath("//a[text()='" + inactiveSamlIdentityProviderDefinition.getLinkText() + "']").doesNotExist());

代码示例来源:origin: cloudfoundry/uaa

.andExpect(xpath("//a[text()='" + samlIdentityProviderDefinition.getLinkText() + "']").doesNotExist());

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com