本文整理汇总了Java中org.assertj.core.util.Strings类的典型用法代码示例。如果您正苦于以下问题:Java Strings类的具体用法?Java Strings怎么用?Java Strings使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Strings类属于org.assertj.core.util包,在下文中一共展示了Strings类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: backupSuccess
import org.assertj.core.util.Strings; //导入依赖的package包/类
@Test public void backupSuccess() throws Exception {
Response httpResponse = backup("test", "Blackops");
assertThat(httpResponse.code()).isEqualTo(200);
InputStream ciphertext = httpResponse.body().byteStream();
ByteArrayOutputStream plaintext = new ByteArrayOutputStream();
Key key = new Key(TEST_EXPORT_KEY_PRIVATE, "password");
// Decrypt and make sure we have expected data in the encrypted backup
Decryptor decryptor = new Decryptor(key);
decryptor.setVerificationRequired(false);
decryptor.decrypt(ciphertext, plaintext);
List<SecretDeliveryResponse> output = mapper.readValue(
plaintext.toByteArray(),
new TypeReference<List<SecretDeliveryResponse>>() {});
assertThat(output)
.extracting(SecretDeliveryResponse::getName)
.containsExactlyInAnyOrder("Hacking_Password", "General_Password");
assertThat(output)
.extracting(SecretDeliveryResponse::getSecret)
.allMatch(s -> !Strings.isNullOrEmpty(s));
}
示例2: directionToString
import org.assertj.core.util.Strings; //导入依赖的package包/类
private static String directionToString(@GridLayoutAnimationControllerDirection int direction) {
List<String> parts = new ArrayList<>();
int horizontal = direction & DIRECTION_HORIZONTAL_MASK;
int vertical = direction & DIRECTION_VERTICAL_MASK;
if ((horizontal & DIRECTION_RIGHT_TO_LEFT) != 0) {
parts.add("rightToLeft");
} else {
parts.add("leftToRight");
}
if ((vertical & DIRECTION_BOTTOM_TO_TOP) != 0) {
parts.add("bottomToTop");
} else {
parts.add("topToBottom");
}
return Strings.join(parts).with(", ");
}
示例3: getAuthHeader
import org.assertj.core.util.Strings; //导入依赖的package包/类
private String getAuthHeader(){
if(Strings.isNullOrEmpty(jwtToken)){
return authHeader.get();
}
else {
return "Bearer " + jwtToken;
}
}
示例4: testCreateCamelCDIProjectFromArchetype
import org.assertj.core.util.Strings; //导入依赖的package包/类
@Test
public void testCreateCamelCDIProjectFromArchetype() throws Exception {
final String namespace = session.getNamespace();
final KubernetesNamespaceAssert asserts = assertThat(client, namespace);
asserts.replicationController(jenkinsName).isNotNull();
asserts.replicationController(nexusName).isNotNull();
asserts.replicationController(gogsName).isNotNull();
asserts.replicationController(fabric8Forge).isNotNull();
asserts.replicationController(fabric8Console).isNotNull();
asserts.podsForService(fabric8Console).runningStatus().assertSize().isGreaterThan(0);
Asserts.assertWaitFor(Millis.minutes(10), new Block() {
@Override
public void invoke() throws Exception {
asserts.podsForReplicationController(fabric8Forge).logs().containsText("oejs.Server:main: Started");
}
});
SeleniumTests.assertWebDriverForService(client, namespace, fabric8Console, new Function<WebDriverFacade, String>() {
@Override
public String apply(WebDriverFacade facade) {
ProjectsPage projects = new ProjectsPage(facade);
String projectName = "p" + NameGenerator.generateName();
// lets find the archetype version to use from the forge pod
Pod forgePod = asserts.podForReplicationController(fabric8Forge);
String archetypesVersionEnvVar = "FABRIC8_ARCHETYPES_VERSION";
String archetypesVersion = KubernetesHelper.getPodEnvVar(forgePod, archetypesVersionEnvVar);
logInfo("the " + fabric8Forge + " pod is using the fabric8 archetypes version: " + archetypesVersion);
assertFalse("No value for $FABRIC8_ARCHETYPES_VERSION found in pod " + forgePod.getMetadata().getName(), Strings.isNullOrEmpty(archetypesVersion));
String archetypeFilter = "io.fabric8.archetypes:cdi-camel-archetype:" + archetypesVersion;
NewProjectFormData projectData = new NewProjectFormData(projectName, archetypeFilter, "maven/CanaryReleaseAndStage.groovy");
projects.createProject(projectData);
// now lets assert that the jenkins build has been created etc
try {
JenkinsServer jenkins = createJenkinsServer(facade.getServiceUrl(ServiceNames.JENKINS));
String jobName = projects.getGogsUserName() + "-" + projectName;
assertJobLastBuildIsSuccessful(Millis.minutes(20), jenkins, jobName);
} catch (Exception e) {
System.out.println("Failed: " + e);
throw new AssertionError(e);
}
return null;
}
});
}
示例5: oauth1aGetRequest
import org.assertj.core.util.Strings; //导入依赖的package包/类
private static HttpRequestBase oauth1aGetRequest(String path, OAuth1aToken oAuth1aToken) {
HttpGet request = new HttpGet(server.uri(path));
StringBuilder authorization = new StringBuilder("OAuth ");
String realm = oAuth1aToken.realm();
if (!Strings.isNullOrEmpty(realm)) {
authorization.append("realm=\"");
authorization.append(realm);
authorization.append("\",");
}
authorization.append("oauth_consumer_key=\"");
authorization.append(oAuth1aToken.consumerKey());
authorization.append("\",oauth_token=\"");
authorization.append(oAuth1aToken.token());
authorization.append("\",oauth_signature_method=\"");
authorization.append(oAuth1aToken.signatureMethod());
authorization.append("\",oauth_signature=\"");
authorization.append(oAuth1aToken.signature());
authorization.append("\",oauth_timestamp=\"");
authorization.append(oAuth1aToken.timestamp());
authorization.append("\",oauth_nonce=\"");
authorization.append(oAuth1aToken.nonce());
authorization.append("\",version=\"");
authorization.append(oAuth1aToken.version());
authorization.append('"');
for (Entry<String, String> entry : oAuth1aToken.additionals().entrySet()) {
authorization.append("\",");
authorization.append(entry.getKey());
authorization.append("=\"");
authorization.append(entry.getValue());
authorization.append('"');
}
request.addHeader("Authorization", authorization.toString());
return request;
}
示例6: getObjects
import org.assertj.core.util.Strings; //导入依赖的package包/类
protected List<TestObject> getObjects(String... queryParams) throws IOException {
String urlString = "http://localhost:" + port + "/test" + path();
if (queryParams.length > 0) {
urlString += "?" + queryParamName() +"=" + Strings.join(queryParams).with("&" + queryParamName() + "=");
}
URL url = new URL(urlString);
return reader.forType(listType).readValue(url.openStream());
}
示例7: navigationDescription
import org.assertj.core.util.Strings; //导入依赖的package包/类
/**
* Build a string representing a navigation from given assert to given property name.
*/
static String navigationDescription(AbstractAssert<?, ?> as, String propertyName) {
String text = as.descriptionText();
if (Strings.isNullOrEmpty(text)) {
text = removeAssert(as.getClass().getSimpleName());
}
return text + " " + propertyName;
}
示例8: should
import org.assertj.core.util.Strings; //导入依赖的package包/类
@Then("^(once finished, )?the last command output should (contain|be|equal to|satisfy|partially satisfy):$")
public void assertLastCommandOutputVerifies(String onceFinished,
String comparator,
String expectedText) throws TimeoutException, InterruptedException, IOException {
Proc proc = procWorld.peekProcess();
if (!Strings.isNullOrEmpty(onceFinished)) {
procWorld.waitTermination(proc);
}
String s = IOUtils.toString(new FileInputStream(proc.getOut()));
StringAssertions.apply(comparator, s, expectedText);
}
示例9: navigationDescription
import org.assertj.core.util.Strings; //导入依赖的package包/类
protected String navigationDescription(String propertyName) {
String text = descriptionText();
if (Strings.isNullOrEmpty(text)) {
text = removeAssert(this.getClass().getSimpleName());
}
return text + " " + propertyName;
}
示例10: url
import org.assertj.core.util.Strings; //导入依赖的package包/类
protected String url(String... paths) {
return "http://127.0.0.1:" + webPort + Strings.join(paths).with("/");
}
示例11: extractedDescriptionOf
import org.assertj.core.util.Strings; //导入依赖的package包/类
public static String extractedDescriptionOf(String... propertiesOrFields) {
return format("Extracted: %s", Strings.join(propertiesOrFields).with(", "));
}
示例12: validatePropertyOrFieldName
import org.assertj.core.util.Strings; //导入依赖的package包/类
private void validatePropertyOrFieldName(String propertyOrFieldName) {
checkArgument(!Strings.isNullOrEmpty(propertyOrFieldName),
"The property/field name to filter on should not be null or empty");
}
示例13: setupActual
import org.assertj.core.util.Strings; //导入依赖的package包/类
@Before
public void setupActual() {
AnotherMethodsClass m = new AnotherMethodsClass();
Strings.isNullOrEmpty(m.string); // causes a synthetic method in AnotherMethodsClass
actual = AnotherMethodsClass.class;
}
示例14: get
import org.assertj.core.util.Strings; //导入依赖的package包/类
public String get() {
if (value == 0) {
return "none";
}
return Strings.join(parts.values()).with(", ");
}