congrats Icon
New! Announcing our next generation AI code completions
Read here
Tabnine Logo
AbstractStringAssert.containsPattern
Code IndexAdd Tabnine to your IDE (free)

How to use
containsPattern
method
in
org.assertj.core.api.AbstractStringAssert

Best Java code snippets using org.assertj.core.api.AbstractStringAssert.containsPattern (Showing top 13 results out of 315)

origin: apache/geode

@Test
public void outputDisplaysResultsFromComplexRegion() throws Exception {
 String result = gfsh.execute("query --query='select c.name, c.address from /complexRegion c'");
 String[] resultLines = splitOnLineBreaks(result);
 assertThat(resultLines[0]).containsPattern("Result\\s+:\\s+true");
 assertThat(resultLines[1]).containsPattern("Limit\\s+:\\s+100");
 assertThat(resultLines[2]).containsPattern("Rows\\s+:\\s+100");
 assertThat(resultLines[3]).containsPattern("name\\s+\\|\\s+address");
 Arrays.asList(resultLines).subList(5, resultLines.length)
   .forEach(line -> assertThat(line).matches("name\\d+.*\"city\":\"Hometown\".*"));
}
origin: apache/geode

/**
 * Verifies that the gfsh output contains the given key, value pair.
 *
 * For example, given the following gfsh output:
 *
 * <pre>
 * {@code
 * Result : true
 * Key Class : java.lang.String
 * Key : key92
 * Locations Found : 2
 * }
 * </pre>
 *
 * We might assert that:
 *
 * <pre>
 * <code> containsKeyValuePair("Key Class", "java.lang.String"); </code>
 * </pre>
 */
public CommandResultAssert containsKeyValuePair(String key, String value) {
 assertThat(actual.getOutput()).containsPattern(key + "\\s+: " + value);
 return this;
}
origin: apache/geode

@Test
public void canOutputComplexRegionToFile() throws Exception {
 File outputFile = temporaryFolder.newFile("queryOutput.txt");
 FileUtils.deleteQuietly(outputFile);
 gfsh.executeAndAssertThat(
   "query --query='select c.name, c.address from /complexRegion c' --file="
     + outputFile.getAbsolutePath())
   .statusIsSuccess().containsOutput(outputFile.getAbsolutePath());
 assertThat(outputFile).exists();
 List<String> lines = Files.readLines(outputFile, StandardCharsets.UTF_8);
 assertThat(lines.get(7)).containsPattern("name\\s+\\|\\s+address");
 lines.subList(9, lines.size())
   .forEach(line -> assertThat(line).matches("name\\d+.*\"city\":\"Hometown\".*"));
}
origin: apache/geode

private void assertLowMemoryException(LowMemoryException exception) {
 assertThat(exception).isExactlyInstanceOf(LowMemoryException.class);
 assertThat(exception.getMessage()).containsPattern(LOW_MEMORY_REGEX);
}
origin: apache/geode

@Test
public void execute_nonexistentAeqId_returnsError() throws Throwable {
 when(cache.getAsyncEventQueue(TEST_AEQ_ID)).thenReturn(null);
 function.execute(mockContext);
 verify(resultSender).lastResult(resultCaptor.capture());
 CliFunctionResult result = resultCaptor.getValue();
 assertThat(result.isSuccessful()).isFalse();
 assertThat(result.getMessage()).containsPattern(TEST_AEQ_ID + ".*not found");
}
origin: apache/geode

 @Test
 public void execute_nonexistentAeqIdIfExists_returnsSuccess() throws Throwable {
  when(cache.getAsyncEventQueue(TEST_AEQ_ID)).thenReturn(null);
  when(mockArgs.isIfExists()).thenReturn(true);

  function.execute(mockContext);
  verify(resultSender).lastResult(resultCaptor.capture());
  CliFunctionResult result = resultCaptor.getValue();

  assertThat(result.isSuccessful()).isTrue();
  assertThat(result.getMessage()).containsPattern("Skipping:.*" + TEST_AEQ_ID + ".*not found");
 }
}
origin: apache/geode

@Test
public void testMixMarshall() throws Exception {
 CacheConfig cache = new CacheConfig();
 setBasicValues(cache);
 cache.getCustomCacheElements().add(new ElementOne("testOne"));
 xml = service.marshall(cache);
 System.out.println(xml);
 assertThat(xml).contains("custom-one>");
 unmarshalled = service2.unMarshall(xml);
 unmarshalled.getCustomCacheElements().add(new ElementTwo("testTwo"));
 // xml generated wtih CacheConfigTwo has both elements in there.
 xml = service.marshall(unmarshalled);
 System.out.println(xml);
 assertThat(xml).contains("custom-one>");
 assertThat(xml).contains("custom-two>");
 assertThat(xml).containsPattern("xmlns=\"http://geode.apache.org/schema/cache\"");
 assertThat(xml).containsPattern("xmlns:ns\\d=\"http://geode.apache.org/schema/CustomOne\"");
 assertThat(xml).containsPattern("xmlns:ns\\d=\"http://geode.apache.org/schema/CustomTwo\"");
}
origin: line/armeria

assertThat(content).containsPattern(
    multilinePattern("server_request_duration_seconds_count",
             "{handler=\"Bar\",hostnamePattern=\"*\",httpStatus=\"200\",",
             "method=\"hello\",pathMapping=\"exact:/bar\",} 1.0"));
assertThat(content).containsPattern(
    multilinePattern("server_request_length_count",
             "{handler=\"Bar\",hostnamePattern=\"*\",httpStatus=\"200\",",
             "method=\"hello\",pathMapping=\"exact:/bar\",} 1.0"));
assertThat(content).containsPattern(
    multilinePattern("server_response_length_count",
             "{handler=\"Bar\",hostnamePattern=\"*\",httpStatus=\"200\",",
             "method=\"hello\",pathMapping=\"exact:/bar\",} 1.0"));
assertThat(content).containsPattern(
    multilinePattern("client_request_duration_seconds_count",
             "{handler=\"Bar\",httpStatus=\"200\",method=\"hello\",} 1.0"));
assertThat(content).containsPattern(
    multilinePattern("client_request_length_count",
             "{handler=\"Bar\",httpStatus=\"200\",method=\"hello\",} 1.0"));
assertThat(content).containsPattern(
    multilinePattern("client_response_length_count",
             "{handler=\"Bar\",httpStatus=\"200\",method=\"hello\",} 1.0"));
assertThat(content).containsPattern(
    multilinePattern("server_requests_total",
             "{handler=\"Bar\",hostnamePattern=\"*\",httpStatus=\"200\",",
             "method=\"hello\",pathMapping=\"exact:/bar\",",
             "result=\"success\",} 1.0"));
assertThat(content).containsPattern(
origin: line/armeria

assertThat(content).containsPattern(
    multilinePattern("server_request_duration_seconds_count",
             "{handler=\"Foo\",hostnamePattern=\"*\",httpStatus=\"200\",",
             "method=\"hello\",pathMapping=\"exact:/foo\",} 7.0"));
assertThat(content).containsPattern(
    multilinePattern("server_request_length_count",
             "{handler=\"Foo\",hostnamePattern=\"*\",httpStatus=\"200\",",
             "method=\"hello\",pathMapping=\"exact:/foo\",} 7.0"));
assertThat(content).containsPattern(
    multilinePattern("server_response_length_count",
             "{handler=\"Foo\",hostnamePattern=\"*\",httpStatus=\"200\",",
             "method=\"hello\",pathMapping=\"exact:/foo\",} 7.0"));
assertThat(content).containsPattern(
    multilinePattern("client_request_duration_seconds_count",
             "{handler=\"Foo\",httpStatus=\"200\",method=\"hello\",} 7.0"));
assertThat(content).containsPattern(
    multilinePattern("client_request_length_count",
             "{handler=\"Foo\",httpStatus=\"200\",method=\"hello\",} 7.0"));
assertThat(content).containsPattern(
    multilinePattern("client_response_length_count",
             "{handler=\"Foo\",httpStatus=\"200\",method=\"hello\",} 7.0"));
assertThat(content).containsPattern(
    multilinePattern("server_requests_total",
             "{handler=\"Foo\",hostnamePattern=\"*\",httpStatus=\"200\",",
             "method=\"hello\",pathMapping=\"exact:/foo\",",
             "result=\"failure\",} 3.0"));
assertThat(content).containsPattern(
origin: jdbi/jdbi

@Test
public void testNeitherHasToString() {
  handle.registerArgument(new FooArgumentFactory());
  handle.createUpdate(INSERT_POSITIONAL).bind(0, new Foo()).execute();
  assertThat(positional).containsPattern("@[0-9a-f]{1,8}$");
}
origin: otto-de/edison-microservice

@Test
public void shouldTriggerJob() {
  final ResponseEntity<String> postResponse = restTemplate.postForEntity("/internal/jobs/Foo", "", String.class);
  assertThat(postResponse.getStatusCodeValue()).isEqualTo(204);
  final ResponseEntity<String> jobResponse = restTemplate.getForEntity(postResponse.getHeaders().getLocation(), String.class);
  assertThat(jobResponse.getStatusCodeValue()).isEqualTo(200);
  assertThat(jobResponse.getBody()).containsPattern(("\"state\"( )*:( )*\"Running\"")); // contains ignoring whitespaces
  assertThat(jobResponse.getBody()).containsPattern("\"jobType\"( )*:( )*\"Foo\""); // contains ignoring whitespaces
}
origin: SpectoLabs/hoverfly-java

@Test
public void shouldLogToStdOut() {
  final Appender<ILoggingEvent> appender = Mockito.mock(Appender.class);
  final Logger logger = (Logger) LoggerFactory.getLogger("hoverfly");
  logger.addAppender(appender);
  logger.setLevel(Level.INFO);
  systemOut.enableLog();
  hoverfly = new Hoverfly(localConfigs().logToStdOut(), SIMULATE);
  hoverfly.start();
  verify(appender, never()).doAppend(any());
  assertThat(systemOut.getLogWithNormalizedLineSeparator()).containsPattern("Default proxy port has been overwritten       [^\n]*port[^\n]*=");
}
origin: SpectoLabs/hoverfly-java

@Test
public void shouldAllowTLSVerificationToBeDisabled() {
  systemOut.enableLog();
  hoverfly = new Hoverfly(localConfigs().logToStdOut().disableTlsVerification(), SIMULATE);
  hoverfly.start();
  assertThat(systemOut.getLogWithNormalizedLineSeparator())
      .containsPattern("TLS certificate verification has been disabled");
}
org.assertj.core.apiAbstractStringAssertcontainsPattern

Popular methods of AbstractStringAssert

  • isEqualTo
  • contains
  • isNull
  • isNotNull
  • startsWith
  • isEmpty
  • isNotEqualTo
  • isNotEmpty
  • doesNotContain
  • as
  • matches
  • endsWith
  • matches,
  • endsWith,
  • isEqualToIgnoringCase,
  • isSameAs,
  • isEqualToIgnoringWhitespace,
  • isIn,
  • isNotBlank,
  • describedAs,
  • isEqualToNormalizingNewlines

Popular in Java

  • Reading from database using SQL prepared statement
  • getSupportFragmentManager (FragmentActivity)
  • getSystemService (Context)
  • compareTo (BigDecimal)
  • FileNotFoundException (java.io)
    Thrown when a file specified by a program cannot be found.
  • MessageFormat (java.text)
    Produces concatenated messages in language-neutral way. New code should probably use java.util.Forma
  • Iterator (java.util)
    An iterator over a sequence of objects, such as a collection.If a collection has been changed since
  • Locale (java.util)
    Locale represents a language/country/variant combination. Locales are used to alter the presentatio
  • ServletException (javax.servlet)
    Defines a general exception a servlet can throw when it encounters difficulty.
  • Location (org.springframework.beans.factory.parsing)
    Class that models an arbitrary location in a Resource.Typically used to track the location of proble
  • Top 12 Jupyter Notebook Extensions
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyStudentsTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now