org.assertj.core.api.AbstractStringAssert类的使用及代码示例

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

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

AbstractStringAssert介绍

暂无

代码示例

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

@Test
public void shouldCreateAnAESCipherFileWithTheCipherIfNotFound() throws IOException, CryptoException {
  assertThat(desCipherFile.exists()).isFalse();
  assertThat(aesCipherFile.exists()).isFalse();
  GoCipher goCipher = new GoCipher(systemEnvironment);
  assertThat(desCipherFile.exists()).isFalse();
  assertThat(aesCipherFile.exists()).isTrue();
  String plainText = goCipher.decrypt(goCipher.encrypt("user-password!"));
  assertThat(plainText).isEqualTo("user-password!");
  assertThat(desCipherFile.exists()).isFalse();
  assertThat(aesCipherFile.exists()).isTrue();
}

代码示例来源:origin: apache/geode

@Test
 public void toStringContainsAllVariables() {
  assertThat(value.toString()).contains(COLUMN_NAME).contains(VALUE.toString())
    .contains(DATA_TYPE.toString());
 }
}

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

@Test
public void constructorWithErrorCodeWhenErrorCodeIsValidThenCreated() {
  BearerTokenError error = new BearerTokenError(TEST_ERROR_CODE, TEST_HTTP_STATUS, null, null);
  assertThat(error.getErrorCode()).isEqualTo(TEST_ERROR_CODE);
  assertThat(error.getHttpStatus()).isEqualTo(TEST_HTTP_STATUS);
  assertThat(error.getDescription()).isNull();
  assertThat(error.getUri()).isNull();
  assertThat(error.getScope()).isNull();
}

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

@Test
public void deserializeGrantedAuthorityTest() throws IOException {
  SimpleGrantedAuthority authority = mapper.readValue(AUTHORITY_JSON, SimpleGrantedAuthority.class);
  assertThat(authority).isNotNull();
  assertThat(authority.getAuthority()).isNotNull().isEqualTo("ROLE_USER");
}

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

@Test
public void nullScenarioEmpty() {
  assertThat(new ErrorFormatter(null).scenarioPrefix)
      .isNotNull()
      .isEmpty();
}

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

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

代码示例来源: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: gocd/gocd

@Test
  public void shouldReEncryptUsingNewKey() throws DecoderException, CryptoException {
    String originalCipherText = "mvcX9yrQsM4iPgm1tDxN1A==";
    String newCipherText = DESEncrypter.reEncryptUsingNewKey(decodeHex("269298bc31c44620"), decodeHex("02644c13cb892962"), originalCipherText);

    assertThat(originalCipherText).isNotEqualTo(newCipherText);

    DESCipherProvider newCipher = mock(DESCipherProvider.class);
    when(newCipher.getKey()).thenReturn(decodeHex("02644c13cb892962"));
    DESEncrypter newEncrypter = new DESEncrypter(newCipher);
    assertThat(newEncrypter.decrypt(newCipherText)).isEqualTo("user-password!");
  }
}

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

@Test
public void deserializeCasAuthenticationTestAfterEraseCredentialInvoked() throws Exception {
  CasAuthenticationToken token = mapper.readValue(CAS_TOKEN_CLEARED_JSON, CasAuthenticationToken.class);
  assertThat(((UserDetails) token.getPrincipal()).getPassword()).isNull();
}

代码示例来源:origin: spring-io/initializr

private void validateHttpIeHelpContent(ResponseEntity<String> response) {
  validateContentType(response, MediaType.TEXT_PLAIN);
  assertThat(response.getHeaders().getFirst(HttpHeaders.ETAG)).isNotNull();
  assertThat(response.getBody()).contains("Spring Initializr", "Examples:", "http")
      .doesNotContain("curl");
}

代码示例来源:origin: spring-io/initializr

private void validateCurlHelpContent(ResponseEntity<String> response) {
  validateContentType(response, MediaType.TEXT_PLAIN);
  assertThat(response.getHeaders().getFirst(HttpHeaders.ETAG)).isNotNull();
  assertThat(response.getBody()).contains("Spring Initializr", "Examples:", "curl");
}

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

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

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

@Test
public void testToStringDoesntAttach() {
  assertThat(onDemand.toString()).isNotNull();
  verify(mockExtensionFactory, never()).attach(any(), any());
}

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

@Test
public void stacktraceHeaderTraceDescription() {
  StringBuilder sb = new StringBuilder();
  AssemblySnapshot e = new AssemblySnapshot("1234", Traces.callSiteSupplierFactory.get());
  FluxOnAssembly.fillStacktraceHeader(sb, String.class, e);
  assertThat(sb.toString())
      .startsWith("\nAssembly trace from producer [java.lang.String]")
      .endsWith(", described as [1234] :\n");
}

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

@Override
  public void doFilter(HttpServletRequest wrappedRequest) {
    String id = wrappedRequest.getSession().getId();
    assertThat(id).isNotNull();
    assertThat(wrappedRequest.getSession().getId()).isEqualTo(id);
    SessionRepositoryFilterTests.this.request.setAttribute(ID_ATTR, id);
  }
});

代码示例来源: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: spring-projects/spring-security

@Test
public void resolveWhenHeaderWithWrongSchemeIsPresentThenTokenIsNotResolved() {
  MockHttpServletRequest request = new MockHttpServletRequest();
  request.addHeader("Authorization", "Basic " + Base64.getEncoder().encodeToString("test:test".getBytes()));
  assertThat(this.resolver.resolve(request)).isNull();
}

代码示例来源:origin: spring-io/initializr

private void validateSpringBootHelpContent(ResponseEntity<String> response) {
  validateContentType(response, MediaType.TEXT_PLAIN);
  assertThat(response.getHeaders().getFirst(HttpHeaders.ETAG)).isNotNull();
  assertThat(response.getBody())
      .contains("Service capabilities", "Supported dependencies")
      .doesNotContain("Examples:", "curl");
}

代码示例来源: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: testcontainers/testcontainers-java

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

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

相关文章

微信公众号

最新文章

更多