本文整理了Java中org.assertj.core.api.AbstractCharSequenceAssert.doesNotContain()
方法的一些代码示例,展示了AbstractCharSequenceAssert.doesNotContain()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。AbstractCharSequenceAssert.doesNotContain()
方法的具体详情如下:
包路径:org.assertj.core.api.AbstractCharSequenceAssert
类名称:AbstractCharSequenceAssert
方法名:doesNotContain
[英]Verifies that the actual CharSequence does not contain the given sequence.
Example :
// assertion will pass
assertThat("Frodo").doesNotContain("fro");
assertThat("Frodo").doesNotContain("gandalf");
// assertion will fail
assertThat("Frodo").doesNotContain("Fro");
[中]验证实际CharSequence是否不包含给定序列。
例子:
// assertion will pass
assertThat("Frodo").doesNotContain("fro");
assertThat("Frodo").doesNotContain("gandalf");
// assertion will fail
assertThat("Frodo").doesNotContain("Fro");
代码示例来源:origin: eclipse-vertx/vert.x
@Test
public void testHiddenCommandUsage() {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
PrintStream stream = new PrintStream(baos);
System.setOut(stream);
itf.execute("hidden", "-h");
assertThat(baos.toString())
.contains("-n <value>")
.doesNotContain("-c ")
.doesNotContain("count");
}
代码示例来源:origin: eclipse-vertx/vert.x
@Test
public void testUsage() {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
PrintStream stream = new PrintStream(baos);
System.setOut(stream);
itf.execute("--help");
assertThat(baos.toString()).contains("hello").contains("bye")
.doesNotContain("hidden").contains("A command saying hello");
}
代码示例来源:origin: eclipse-vertx/vert.x
@Test
public void testUsageWhenNoArgsAndOptions() {
final CLI cli = CLI.create("test").setDescription("A simple test command.");
StringBuilder builder = new StringBuilder();
cli.usage(builder);
assertThat(builder.toString())
.contains("test")
.doesNotContain("Options").doesNotContain("Arguments");
}
代码示例来源:origin: eclipse-vertx/vert.x
@Test
public void testUsageOnDifferentStream() {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
PrintStream stream = new PrintStream(baos);
itf = new VertxCommandLauncher() {
/**
* @return the printer used to write the messages. Defaults to {@link System#out}.
*/
@Override
public PrintStream getPrintStream() {
return stream;
}
};
itf.execute("--help");
assertThat(baos.toString()).contains("hello").contains("bye")
.doesNotContain("hidden").contains("A command saying hello");
}
代码示例来源:origin: SonarSource/sonarqube
/**
* Check that log message is not formatted, i.e. has no log level and timestamp.
*/
private void assertMsgClean(String msg) {
// FP: [JOURNAL_FLUSHER] WARNING Journal flush operation took 2,093ms last 8 cycles average is 262ms
if (msg.contains("[JOURNAL_FLUSHER]")) {
return;
}
for (LogOutput.Level l : LogOutput.Level.values()) {
assertThat(msg).doesNotContain(l.toString());
}
Matcher matcher = simpleTimePattern.matcher(msg);
assertThat(matcher.find()).isFalse();
}
代码示例来源:origin: eclipse-vertx/vert.x
@Test
public void testOldBareWithClusterHost() throws InterruptedException, IOException {
record();
cli.dispatch(new String[]{"-ha", "-cluster-host", "127.0.0.1"});
assertWaitUntil(() -> error.toString().contains("A quorum has been obtained."));
stop();
assertThat(error.toString())
.contains("Starting clustering...")
.doesNotContain("No cluster-host specified")
.contains("Any deploymentIDs waiting on a quorum will now be deployed");
}
代码示例来源:origin: eclipse-vertx/vert.x
@Test
public void testRegularBareCommandWithClusterHost() {
record();
cli.dispatch(new String[]{"bare", "-cluster-host", "127.0.0.1"});
assertWaitUntil(() -> error.toString().contains("A quorum has been obtained."));
assertThatVertxInstanceHasBeenCreated();
stop();
assertThat(error.toString())
.contains("Starting clustering...")
.doesNotContain("No cluster-host specified")
.contains("Any deploymentIDs waiting on a quorum will now be deployed");
}
代码示例来源:origin: SonarSource/sonarqube
@Test
public void token_does_not_contain_colon() {
assertThat(underTest.generate()).doesNotContain(":");
}
代码示例来源:origin: SonarSource/sonarqube
@Test
public void dontLogInvalidOrganization() throws IOException {
File srcDir = new File(baseDir, "src");
srcDir.mkdir();
File xooFile = new File(srcDir, "sample.xoo");
FileUtils.write(xooFile, "Sample xoo\ncontent", StandardCharsets.UTF_8);
tester.newAnalysis()
.properties(builder
.put("sonar.sources", "src")
.build())
.execute();
assertThat(logTester.logs()).contains("Project key: com.foo.project");
assertThat(logTester.logs().stream().collect(joining("\n"))).doesNotContain("Organization key");
assertThat(logTester.logs().stream().collect(joining("\n"))).doesNotContain("Branch key");
}
代码示例来源:origin: twosigma/beakerx
@Test
public void appendErrorWithNotDesirableMessage_outputDataDoesNotContainThatMessage() throws Exception {
String notDesirableMessage = "JavaSourceCompilerImpl compile";
//when
seo.appendError("test\n" + notDesirableMessage + "\n");
//then
SimpleEvaluationObject.EvaluationStdError stdErr =
(SimpleEvaluationObject.EvaluationStdError) seo.getOutputdata().get(0);
Assertions.assertThat(stdErr.payload).doesNotContain(notDesirableMessage);
Assertions.assertThat(stdErr.payload).contains("test");
}
代码示例来源:origin: SonarSource/sonarqube
@Test
public void edition_is_not_returned_if_not_defined() {
init();
when(editionProvider.get()).thenReturn(Optional.empty());
String json = call();
assertThat(json).doesNotContain("edition");
}
代码示例来源:origin: SonarSource/sonarqube
@Test
public void do_not_log_submitter_param_if_anonymous_and_success() throws Exception {
when(queue.peek(anyString())).thenReturn(Optional.of(createCeTask(null)));
taskProcessorRepository.setProcessorForTask(CeTaskTypes.REPORT, taskProcessor);
underTest.call();
verifyWorkerUuid();
List<String> logs = logTester.logs(LoggerLevel.INFO);
assertThat(logs).hasSize(2);
for (int i = 0; i < 2; i++) {
assertThat(logs.get(i)).doesNotContain("submitter=");
}
}
代码示例来源:origin: SonarSource/sonarqube
@Test
public void search_metrics_ordered_by_name_case_insensitive() throws Exception {
insertNewCustomMetric("3", "1", "2");
String firstResult = newRequest().setParam(Param.PAGE, "1").setParam(Param.PAGE_SIZE, "1").execute().outputAsString();
String secondResult = newRequest().setParam(Param.PAGE, "2").setParam(Param.PAGE_SIZE, "1").execute().outputAsString();
String thirdResult = newRequest().setParam(Param.PAGE, "3").setParam(Param.PAGE_SIZE, "1").execute().outputAsString();
assertThat(firstResult).contains("custom-key-1").doesNotContain("custom-key-2").doesNotContain("custom-key-3");
assertThat(secondResult).contains("custom-key-2").doesNotContain("custom-key-1").doesNotContain("custom-key-3");
assertThat(thirdResult).contains("custom-key-3").doesNotContain("custom-key-1").doesNotContain("custom-key-2");
}
代码示例来源:origin: SonarSource/sonarqube
@Test
public void list_metric_with_chosen_fields() throws Exception {
insertNewCustomMetric("1");
String result = newRequest().setParam(Param.FIELDS, "name").execute().outputAsString();
assertThat(result).contains("id", "key", "name", "type")
.doesNotContain("domain")
.doesNotContain("description");
}
代码示例来源:origin: SonarSource/sonarqube
@Test
public void data_contains_no_license_type_on_commercial_edition_if_no_license() throws IOException {
initTelemetrySettingsToDefaultValues();
settings.setProperty("sonar.telemetry.frequencyInSeconds", "1");
when(licenseReader.read()).thenReturn(Optional.empty());
commercialUnderTest.start();
ArgumentCaptor<String> jsonCaptor = captureJson();
assertThat(jsonCaptor.getValue()).doesNotContain("licenseType");
}
代码示例来源:origin: twosigma/beakerx
@Test
public void createPomWithType() throws Exception {
//given
Dependency dependency = Dependency.create(asList("group", "art", "ver", "pom"));
//when
String pomAsString = pomFactory.createPom(new PomFactory.Params("/", asList(dependency), Maps.newHashMap(), MavenJarResolver.GOAL, MavenJarResolver.MAVEN_BUILT_CLASSPATH_FILE_NAME));
//then
assertThat(removeWhitespaces(pomAsString)).contains("<type>pom</type>");
assertThat(removeWhitespaces(pomAsString)).doesNotContain("<classifier");
}
代码示例来源:origin: SonarSource/sonarqube
@Test
public void list_metric_with_is_custom_false() throws Exception {
insertNewCustomMetric("1", "2");
insertNewNonCustomMetric("3");
String result = newRequest()
.setParam(PARAM_IS_CUSTOM, "false").execute().outputAsString();
assertThat(result).doesNotContain("custom-key-1")
.doesNotContain("custom-key-2")
.contains("non-custom-key-3");
}
代码示例来源:origin: SonarSource/sonarqube
@Test
public void data_contains_no_license_type_on_community_edition() throws IOException {
initTelemetrySettingsToDefaultValues();
settings.setProperty("sonar.telemetry.frequencyInSeconds", "1");
communityUnderTest.start();
ArgumentCaptor<String> jsonCaptor = captureJson();
assertThat(jsonCaptor.getValue()).doesNotContain("licenseType");
}
代码示例来源:origin: stagemonitor/stagemonitor
@Test
public void testNestedTracing() throws Exception {
final TracedNestedTestClass testClass = new TracedNestedTestClass();
testClass.foo();
final SpanContextInformation barInfo = spanCapturingReporter.get();
final SpanContextInformation fooInfo = spanCapturingReporter.get();
assertThat(fooInfo.getOperationName()).contains("foo").doesNotContain("bar");
assertThat(fooInfo.getCallTree().getSignature()).contains("foo").doesNotContain("bar");
assertThat(fooInfo.getCallTree().getChildren().get(0).getChildren().get(0).getSignature()).contains("bar()");
assertThat(barInfo.getCallTree()).isNull();
}
代码示例来源:origin: SonarSource/sonarqube
@Test
public void search_for_users_with_query_as_a_parameter() {
insertUsersHavingGlobalPermissions();
loginAsAdmin(db.getDefaultOrganization());
String result = newRequest()
.setParam("permission", "scan")
.setParam(TEXT_QUERY, "ame-1")
.execute()
.getInput();
assertThat(result).contains("login-1")
.doesNotContain("login-2")
.doesNotContain("login-3");
}
内容来源于网络,如有侵权,请联系作者删除!