org.assertj.core.api.AbstractStringAssert.startsWith()方法的使用及代码示例

x33g5p2x  于2022-01-15 转载在 其他  
字(8.3k)|赞(0)|评价(0)|浏览(147)

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

AbstractStringAssert.startsWith介绍

暂无

代码示例

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

@Test
public void genSaltGeneratesCorrectSaltPrefix() {
  assertThat(BCrypt.gensalt(4)).startsWith("$2a$04$");
  assertThat(BCrypt.gensalt(31)).startsWith("$2a$31$");
}

代码示例来源:origin: gocd/gocd

@Test
public void shouldGenerateEncryptedText() throws CryptoException {
  String encrypt = aesEncrypter.encrypt("p@ssw0rd");
  assertThat(encrypt).startsWith("AES");
  assertThat(encrypt.split(":")).hasSize(3);
}

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

@Test
public void successIsLoggedIfAceRequiresSuccessAudit() throws Exception {
  when(ace.isAuditSuccess()).thenReturn(true);
  logger.logIfNeeded(true, ace);
  assertThat(bytes.toString()).startsWith("GRANTED due to ACE");
}

代码示例来源:origin: reactor/reactor-core

@Test
public void debug2() throws Exception {
  logger.debug("with cause", CAUSE);
  assertThat(errContent.size()).isZero();
  assertThat(outContent.toString())
      .startsWith("[DEBUG] (" + Thread.currentThread().getName() + ") with cause - java.lang.IllegalStateException: cause" +
          "\njava.lang.IllegalStateException: cause\n" +
          "\tat reactor.util.ConsoleLoggerTest");
}

代码示例来源:origin: reactor/reactor-core

@Test
public void info2() throws Exception {
  logger.info("with cause", CAUSE);
  assertThat(errContent.size()).isZero();
  assertThat(outContent.toString())
      .startsWith("[ INFO] (" + Thread.currentThread().getName() + ") with cause - java.lang.IllegalStateException: cause" +
          "\njava.lang.IllegalStateException: cause\n" +
          "\tat reactor.util.ConsoleLoggerTest");
}

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

@Test
  public void failureIsLoggedIfAceRequiresFailureAudit() throws Exception {
    when(ace.isAuditFailure()).thenReturn(true);
    logger.logIfNeeded(false, ace);
    assertThat(bytes.toString()).startsWith("DENIED due to ACE");
  }
}

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

@Test
public void encodeWhenDefaultThenBCryptUsed() {
  String encodedPassword = this.encoder.encode(this.rawPassword);
  assertThat(encodedPassword).startsWith("{bcrypt}");
  assertThat(this.encoder.matches(this.rawPassword, encodedPassword)).isTrue();
}

代码示例来源:origin: testcontainers/testcontainers-java

@Test
public void shouldReturnBoltUrl() {
  String actual = neo4jContainer.getBoltUrl();
  assertThat(actual).isNotNull();
  assertThat(actual).startsWith("bolt://");
}

代码示例来源:origin: testcontainers/testcontainers-java

@Test
  public void shouldReturnHttpUrl() {
    String actual = neo4jContainer.getHttpUrl();

    assertThat(actual).isNotNull();
    assertThat(actual).startsWith("http://");
  }
}

代码示例来源:origin: reactor/reactor-core

@Test
public void stepNameAndToString() {
  AssemblySnapshot stacktrace = new AssemblySnapshot(null, Traces.callSiteSupplierFactory.get());
  MonoCallableOnAssembly<?> test = new MonoCallableOnAssembly<>(Mono.empty(), stacktrace);
  assertThat(test.toString())
      .isEqualTo(test.stepName())
      .startsWith("reactor.core.publisher.MonoCallableOnAssemblyTest.stepNameAndToString(MonoCallableOnAssemblyTest.java:");
}

代码示例来源:origin: reactor/reactor-core

@Test
public void stepNameAndToString() {
  AssemblySnapshot stacktrace = new AssemblySnapshot(null, Traces.callSiteSupplierFactory.get());
  MonoOnAssembly<?> test = new MonoOnAssembly<>(Mono.empty(), stacktrace);
  assertThat(test.toString())
      .isEqualTo(test.stepName())
      .startsWith("reactor.core.publisher.MonoOnAssemblyTest.stepNameAndToString(MonoOnAssemblyTest.java:");
}

代码示例来源:origin: reactor/reactor-core

@Test
  public void stepNameAndToString() {
    AssemblySnapshot stacktrace = new AssemblySnapshot(null, Traces.callSiteSupplierFactory.get());
    FluxCallableOnAssembly<?> test = new FluxCallableOnAssembly<>(Flux.empty(), stacktrace);

    assertThat(test.toString())
        .isEqualTo(test.stepName())
        .startsWith("reactor.core.publisher.FluxCallableOnAssemblyTest.stepNameAndToString(FluxCallableOnAssemblyTest.java:");
  }
}

代码示例来源:origin: gocd/gocd

@Test
  public void shouldConvertFromDESEncryptedTextToAES() throws IOException, CryptoException {
    resetCipher.setupAESCipherFile();
    resetCipher.setupDESCipherFile();

    GoCipher goCipher = new GoCipher(systemEnvironment);
    String cipherText = goCipher.desToAES("mvcX9yrQsM4iPgm1tDxN1A==");
    assertThat(cipherText).startsWith("AES:");
  }
}

代码示例来源:origin: reactor/reactor-core

@Test
public void stepNameAndToString() {
  AssemblySnapshot stacktrace = new AssemblySnapshot(null, Traces.callSiteSupplierFactory.get());
  ConnectableFluxOnAssembly<?> test = new ConnectableFluxOnAssembly<>(Flux.empty().publish(), stacktrace);
  assertThat(test.toString())
      .isEqualTo(test.stepName())
      .startsWith("reactor.core.publisher.ConnectableFluxOnAssemblyTest.stepNameAndToString(ConnectableFluxOnAssemblyTest.java:");
}

代码示例来源:origin: reactor/reactor-core

@Test
public void stepNameAndToString() {
  ParallelFlux<Integer> source = Flux.range(1, 4).parallel(3);
  AssemblySnapshot stacktrace = new AssemblySnapshot("foo", Traces.callSiteSupplierFactory.get());
  ParallelFluxOnAssembly<Integer> test = new ParallelFluxOnAssembly<>(source, stacktrace);
  assertThat(test.toString())
      .isEqualTo(test.stepName())
      .startsWith("reactor.core.publisher.ParallelFluxOnAssemblyTest.stepNameAndToString(ParallelFluxOnAssemblyTest.java:");
}

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

@Test
public void getTokenResponseWhenClientAuthenticationBasicThenAuthorizationHeaderIsSent() throws Exception {
  String accessTokenSuccessResponse = "{\n" +
      "	\"access_token\": \"access-token-1234\",\n" +
      "   \"token_type\": \"bearer\",\n" +
      "   \"expires_in\": \"3600\"\n" +
      "}\n";
  this.server.enqueue(jsonResponse(accessTokenSuccessResponse));
  this.tokenResponseClient.getTokenResponse(this.authorizationCodeGrantRequest());
  RecordedRequest recordedRequest = this.server.takeRequest();
  assertThat(recordedRequest.getHeader(HttpHeaders.AUTHORIZATION)).startsWith("Basic ");
}

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

@Test
public void defaultLoginPageWithSingleClientRegistrationThenRedirect() {
  this.spring.register(OAuth2LoginWithSingleClientRegistrations.class).autowire();
  WebTestClient webTestClient = WebTestClientBuilder
      .bindToWebFilters(new GitHubWebFilter(), this.springSecurity)
      .build();
  WebDriver driver = WebTestClientHtmlUnitDriverBuilder
      .webTestClientSetup(webTestClient)
      .build();
  driver.get("http://localhost/");
  assertThat(driver.getCurrentUrl()).startsWith("https://github.com/login/oauth/authorize");
}

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

@Test
public void loadConfigWhenInMemoryConfigureGlobalThenPasswordUpgraded() throws Exception {
  this.spring.register(InMemoryConfigureGlobalConfig.class).autowire();
  this.mockMvc.perform(formLogin())
      .andExpect(status().is3xxRedirection());
  UserDetailsService uds = this.spring.getContext()
      .getBean(UserDetailsService.class);
  assertThat(uds.loadUserByUsername("user").getPassword()).startsWith("{bcrypt}");
}

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

@Test
public void loadConfigWhenInMemoryConfigureProtectedThenPasswordUpgraded() throws Exception {
  this.spring.register(InMemoryConfigureProtectedConfig.class).autowire();
  this.mockMvc.perform(formLogin())
      .andExpect(status().is3xxRedirection());
  UserDetailsService uds = this.spring.getContext()
      .getBean(UserDetailsService.class);
  assertThat(uds.loadUserByUsername("user").getPassword()).startsWith("{bcrypt}");
}

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

@Test
public void passwordUpdateManagerUsed() {
  this.spring.register(MapReactiveUserDetailsServiceConfig.class).autowire();
  WebTestClient client = WebTestClientBuilder.bindToWebFilters(this.springSecurityFilterChain).build();
  client
      .get()
      .uri("/")
      .headers(h -> h.setBasicAuth("user", "password"))
      .exchange()
      .expectStatus().isOk();
  ReactiveUserDetailsService users = this.spring.getContext().getBean(ReactiveUserDetailsService.class);
  assertThat(users.findByUsername("user").block().getPassword()).startsWith("{bcrypt}");
}

相关文章

微信公众号

最新文章

更多