本文整理了Java中org.assertj.core.api.AbstractStringAssert.isEmpty()
方法的一些代码示例,展示了AbstractStringAssert.isEmpty()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。AbstractStringAssert.isEmpty()
方法的具体详情如下:
包路径:org.assertj.core.api.AbstractStringAssert
类名称:AbstractStringAssert
方法名:isEmpty
暂无
代码示例来源:origin: reactor/reactor-core
@Test
public void nullScenarioEmpty() {
assertThat(new ErrorFormatter(null).scenarioPrefix)
.isNotNull()
.isEmpty();
}
代码示例来源:origin: apache/geode
@Test
public void testGeodeLogLevel() {
when(parseResult.getParamValueAsString("log-level")).thenReturn("fine");
when(parseResult.getParamValueAsString("loglevel")).thenReturn("fine");
for (AbstractCliAroundInterceptor interceptor : interceptors) {
result = (Result) interceptor.preExecution(parseResult);
assertThat(result.nextLine()).isEmpty();
}
}
代码示例来源:origin: apache/geode
@Test
public void testLog4JLevel() {
when(parseResult.getParamValueAsString("log-level")).thenReturn("trace");
when(parseResult.getParamValueAsString("loglevel")).thenReturn("trace");
for (AbstractCliAroundInterceptor interceptor : interceptors) {
result = (Result) interceptor.preExecution(parseResult);
assertThat(result.nextLine()).isEmpty();
}
}
}
代码示例来源:origin: reactor/reactor-core
@Test
public void noScenarioEmpty() {
assertThat(new ErrorFormatter("").scenarioPrefix)
.isNotNull()
.isEmpty();
}
代码示例来源:origin: spring-projects/spring-session
@Test
public void onDeleteSessionMulti() {
this.resolver.expireSession(this.request, this.response);
this.resolver.expireSession(this.request, this.response);
assertThat(this.response.getHeaders(HEADER_X_AUTH_TOKEN).size()).isEqualTo(1);
assertThat(getSessionId()).isEmpty();
}
代码示例来源:origin: spring-projects/spring-session
@Test
public void onDeleteSession() {
this.resolver.expireSession(this.request, this.response);
assertThat(getSessionId()).isEmpty();
}
代码示例来源:origin: spring-projects/spring-session
@Test
public void onDeleteSession() throws Exception {
this.strategy.expireSession(this.request, this.response);
assertThat(getSessionId()).isEmpty();
}
代码示例来源:origin: jdbi/jdbi
@Test
public void testDefineNullDoesntWriteToStderr() {
assertThat(h.createQuery("select true<if(defined)>broken<endif>")
.define("defined", null)
.mapTo(boolean.class)
.findOnly())
.isEqualTo(true);
assertThat(err.toString()).isEmpty();
}
}
代码示例来源:origin: apache/geode
@Test
public void testStartEnd() {
when(parseResult.getParamValueAsString("start-time")).thenReturn("2000/01/01");
when(parseResult.getParamValueAsString("end-time")).thenReturn("2000/01/02");
result = interceptor.preExecution(parseResult);
assertThat(result.nextLine()).isEmpty();
when(parseResult.getParamValueAsString("start-time")).thenReturn("2000/01/02");
when(parseResult.getParamValueAsString("end-time")).thenReturn("2000/01/01");
result = interceptor.preExecution(parseResult);
assertThat(result.nextLine()).contains("start-time has to be earlier than end-time");
}
代码示例来源:origin: apache/geode
@Test
public void testInclideStats() {
when(parseResult.getParamValue("logs-only")).thenReturn(true);
when(parseResult.getParamValue("stats-only")).thenReturn(false);
result = interceptor.preExecution(parseResult);
assertThat(result.nextLine()).isEmpty();
when(parseResult.getParamValue("logs-only")).thenReturn(true);
when(parseResult.getParamValue("stats-only")).thenReturn(true);
result = interceptor.preExecution(parseResult);
assertThat(result.nextLine()).contains("logs-only and stats-only can't both be true");
}
}
代码示例来源:origin: gocd/gocd
@Test
public void shouldNotSetConfigurationWhenArtifactIdIsNotProvided() {
final HashMap<Object, Object> configAttrs = new HashMap<>();
configAttrs.put(FetchPluggableArtifactTask.ARTIFACT_ID, "");
configAttrs.put(FetchPluggableArtifactTask.CONFIGURATION, Collections.singletonMap("NAME", "gocd.zip"));
FetchPluggableArtifactTask task = new FetchPluggableArtifactTask(new CaseInsensitiveString("#{pipeline}"), new CaseInsensitiveString("#{stage}"), new CaseInsensitiveString("#{job}"), "#{artifactId}");
task.setFetchTaskAttributes(configAttrs);
Assertions.assertThat(task.getArtifactId()).isEmpty();
Assertions.assertThat(task.getConfiguration()).isEmpty();
}
}
代码示例来源:origin: spring-projects/spring-security
@Test
public void filterWhenDefaultClientRegistrationIdThenAuthorizedClientResolved() {
this.function.setDefaultClientRegistrationId(this.registration.getRegistrationId());
OAuth2RefreshToken refreshToken = new OAuth2RefreshToken("refresh-token", this.accessToken.getIssuedAt());
OAuth2AuthorizedClient authorizedClient = new OAuth2AuthorizedClient(this.registration,
"principalName", this.accessToken, refreshToken);
when(this.authorizedClientRepository.loadAuthorizedClient(any(), any(), any())).thenReturn(Mono.just(authorizedClient));
when(this.clientRegistrationRepository.findByRegistrationId(any())).thenReturn(Mono.just(this.registration));
ClientRequest request = ClientRequest.create(GET, URI.create("https://example.com"))
.build();
this.function.filter(request, this.exchange).block();
List<ClientRequest> requests = this.exchange.getRequests();
assertThat(requests).hasSize(1);
ClientRequest request0 = requests.get(0);
assertThat(request0.headers().getFirst(HttpHeaders.AUTHORIZATION)).isEqualTo("Bearer token-0");
assertThat(request0.url().toASCIIString()).isEqualTo("https://example.com");
assertThat(request0.method()).isEqualTo(HttpMethod.GET);
assertThat(getBody(request0)).isEmpty();
}
代码示例来源:origin: spring-projects/spring-security
@Test
public void filterWhenClientRegistrationIdThenAuthorizedClientResolved() {
OAuth2RefreshToken refreshToken = new OAuth2RefreshToken("refresh-token", this.accessToken.getIssuedAt());
OAuth2AuthorizedClient authorizedClient = new OAuth2AuthorizedClient(this.registration,
"principalName", this.accessToken, refreshToken);
when(this.authorizedClientRepository.loadAuthorizedClient(any(), any(), any())).thenReturn(Mono.just(authorizedClient));
when(this.clientRegistrationRepository.findByRegistrationId(any())).thenReturn(Mono.just(this.registration));
ClientRequest request = ClientRequest.create(GET, URI.create("https://example.com"))
.attributes(clientRegistrationId(this.registration.getRegistrationId()))
.build();
this.function.filter(request, this.exchange).block();
List<ClientRequest> requests = this.exchange.getRequests();
assertThat(requests).hasSize(1);
ClientRequest request0 = requests.get(0);
assertThat(request0.headers().getFirst(HttpHeaders.AUTHORIZATION)).isEqualTo("Bearer token-0");
assertThat(request0.url().toASCIIString()).isEqualTo("https://example.com");
assertThat(request0.method()).isEqualTo(HttpMethod.GET);
assertThat(getBody(request0)).isEmpty();
}
代码示例来源:origin: spring-projects/spring-security
@Test
public void filterWhenRefreshTokenNullThenShouldRefreshFalse() {
OAuth2AuthorizedClient authorizedClient = new OAuth2AuthorizedClient(this.registration,
"principalName", this.accessToken);
ClientRequest request = ClientRequest.create(GET, URI.create("https://example.com"))
.attributes(oauth2AuthorizedClient(authorizedClient))
.build();
this.function.filter(request, this.exchange).block();
List<ClientRequest> requests = this.exchange.getRequests();
assertThat(requests).hasSize(1);
ClientRequest request0 = requests.get(0);
assertThat(request0.headers().getFirst(HttpHeaders.AUTHORIZATION)).isEqualTo("Bearer token-0");
assertThat(request0.url().toASCIIString()).isEqualTo("https://example.com");
assertThat(request0.method()).isEqualTo(HttpMethod.GET);
assertThat(getBody(request0)).isEmpty();
}
代码示例来源:origin: spring-projects/spring-security
@Test
public void filterWhenRefreshTokenNullThenShouldRefreshFalse() {
this.function = new ServletOAuth2AuthorizedClientExchangeFilterFunction(this.clientRegistrationRepository,
this.authorizedClientRepository);
OAuth2AuthorizedClient authorizedClient = new OAuth2AuthorizedClient(this.registration,
"principalName", this.accessToken);
ClientRequest request = ClientRequest.create(GET, URI.create("https://example.com"))
.attributes(oauth2AuthorizedClient(authorizedClient))
.build();
this.function.filter(request, this.exchange).block();
List<ClientRequest> requests = this.exchange.getRequests();
assertThat(requests).hasSize(1);
ClientRequest request0 = requests.get(0);
assertThat(request0.headers().getFirst(HttpHeaders.AUTHORIZATION)).isEqualTo("Bearer token-0");
assertThat(request0.url().toASCIIString()).isEqualTo("https://example.com");
assertThat(request0.method()).isEqualTo(HttpMethod.GET);
assertThat(getBody(request0)).isEmpty();
}
代码示例来源:origin: spring-projects/spring-security
@Test
public void filterWhenNotExpiredThenShouldRefreshFalse() {
OAuth2RefreshToken refreshToken = new OAuth2RefreshToken("refresh-token", this.accessToken.getIssuedAt());
OAuth2AuthorizedClient authorizedClient = new OAuth2AuthorizedClient(this.registration,
"principalName", this.accessToken, refreshToken);
ClientRequest request = ClientRequest.create(GET, URI.create("https://example.com"))
.attributes(oauth2AuthorizedClient(authorizedClient))
.build();
this.function.filter(request, this.exchange).block();
List<ClientRequest> requests = this.exchange.getRequests();
assertThat(requests).hasSize(1);
ClientRequest request0 = requests.get(0);
assertThat(request0.headers().getFirst(HttpHeaders.AUTHORIZATION)).isEqualTo("Bearer token-0");
assertThat(request0.url().toASCIIString()).isEqualTo("https://example.com");
assertThat(request0.method()).isEqualTo(HttpMethod.GET);
assertThat(getBody(request0)).isEmpty();
}
代码示例来源:origin: spring-projects/spring-session
@Test
public void onDeleteSessionCustomCookieName() throws Exception {
setCookieName("CUSTOM");
this.strategy.expireSession(this.request, this.response);
assertThat(getSessionId()).isEmpty();
}
代码示例来源:origin: spring-projects/spring-security
@Test
public void filterWhenClientCredentialsTokenNotExpiredThenUseCurrentToken() {
this.registration = TestClientRegistrations.clientCredentials().build();
this.function = new ServletOAuth2AuthorizedClientExchangeFilterFunction(this.clientRegistrationRepository,
this.authorizedClientRepository);
this.function.setClientCredentialsTokenResponseClient(this.clientCredentialsTokenResponseClient);
OAuth2AuthorizedClient authorizedClient = new OAuth2AuthorizedClient(this.registration,
"principalName", this.accessToken, null);
ClientRequest request = ClientRequest.create(GET, URI.create("https://example.com"))
.attributes(oauth2AuthorizedClient(authorizedClient))
.attributes(authentication(this.authentication))
.build();
this.function.filter(request, this.exchange).block();
verify(this.authorizedClientRepository, never()).saveAuthorizedClient(any(), eq(this.authentication), any(), any());
verify(clientCredentialsTokenResponseClient, never()).getTokenResponse(any());
List<ClientRequest> requests = this.exchange.getRequests();
assertThat(requests).hasSize(1);
ClientRequest request1 = requests.get(0);
assertThat(request1.headers().getFirst(HttpHeaders.AUTHORIZATION)).isEqualTo("Bearer token-0");
assertThat(request1.url().toASCIIString()).isEqualTo("https://example.com");
assertThat(request1.method()).isEqualTo(HttpMethod.GET);
assertThat(getBody(request1)).isEmpty();
}
代码示例来源:origin: spring-projects/spring-security
@Test
public void filterWhenNotExpiredThenShouldRefreshFalse() {
this.function = new ServletOAuth2AuthorizedClientExchangeFilterFunction(this.clientRegistrationRepository,
this.authorizedClientRepository);
OAuth2RefreshToken refreshToken = new OAuth2RefreshToken("refresh-token", this.accessToken.getIssuedAt());
OAuth2AuthorizedClient authorizedClient = new OAuth2AuthorizedClient(this.registration,
"principalName", this.accessToken, refreshToken);
ClientRequest request = ClientRequest.create(GET, URI.create("https://example.com"))
.attributes(oauth2AuthorizedClient(authorizedClient))
.build();
this.function.filter(request, this.exchange).block();
List<ClientRequest> requests = this.exchange.getRequests();
assertThat(requests).hasSize(1);
ClientRequest request0 = requests.get(0);
assertThat(request0.headers().getFirst(HttpHeaders.AUTHORIZATION)).isEqualTo("Bearer token-0");
assertThat(request0.url().toASCIIString()).isEqualTo("https://example.com");
assertThat(request0.method()).isEqualTo(HttpMethod.GET);
assertThat(getBody(request0)).isEmpty();
}
代码示例来源:origin: line/armeria
@Test
public void shouldReturnEchoResponse() {
final ArmeriaReactiveWebServerFactory factory = factory();
runEchoServer(factory, server -> {
final HttpClient client = httpClient(server);
validateEchoResponse(sendPostRequest(client));
final AggregatedHttpMessage res = client.get("/hello").aggregate().join();
assertThat(res.status()).isEqualTo(com.linecorp.armeria.common.HttpStatus.OK);
assertThat(res.content().toStringUtf8()).isEmpty();
});
}
内容来源于网络,如有侵权,请联系作者删除!