use of org.hamcrest.core.StringContains in project cactoos by yegor256.
the class LoggingOutputTest method logWriteToLargeTextFile.
@Test
@SuppressWarnings("unchecked")
public void logWriteToLargeTextFile() throws Exception {
final Logger logger = new FakeLogger();
final Path temp = this.folder.newFolder("ccts-1").toPath();
final Path path = temp.resolve("x/y/z/file.txt");
try (OutputStream output = new LoggingOutput(new OutputTo(path), "text file", logger).stream()) {
new LengthOf(new TeeInput(new ResourceOf("org/cactoos/large-text.txt"), new OutputTo(output))).value();
}
new Assertion<>("Must log write and close operations to text file", logger.toString(), new AllOf<>(new IsNot<String>(new StringContains("Written 16384 byte(s) to text file")), new StringContains("Written 74536 byte(s) to text file"), new StringContains("Closed output stream from text file"))).affirm();
}
use of org.hamcrest.core.StringContains in project jbosstools-openshift by jbosstools.
the class CreateServerAdapterTest method finishNewServerAdapterWizardAndVerifyExistence.
public void finishNewServerAdapterWizardAndVerifyExistence() {
new FinishButton().click();
new WaitWhile(new ShellIsAvailable(OpenShiftLabel.Shell.ADAPTER));
boolean jobExists = false;
try {
new WaitUntil(new JobIsRunning(new StringContains(JOB_NAME)), TimePeriod.getCustom(5));
jobExists = true;
} catch (WaitTimeoutExpiredException e) {
// job is not running, do nothing
}
if (jobExists) {
new WaitUntil(new JobIsKilled(JOB_NAME), TimePeriod.VERY_LONG);
}
assertTrue("OpenShift server adapter was not created.", new ServerAdapterExists(Version.OPENSHIFT3, OpenShiftResources.EAP_SERVICE, "Service").test());
}
use of org.hamcrest.core.StringContains in project jbosstools-openshift by jbosstools.
the class DeployDockerImageTest method verifyDeployedHelloWorldDockerImage.
/**
* Verifies whether an application pod has been created and application is running successfully.
*/
private void verifyDeployedHelloWorldDockerImage(String projectName) {
new OpenShiftExplorerView().getOpenShift3Connection(openshiftConnectionRequirement.getConnection()).refresh();
try {
new WaitUntil(new OpenShiftResourceExists(Resource.POD, new StringContains("hello-openshift"), ResourceState.RUNNING, projectName, openshiftConnectionRequirement.getConnection()), TimePeriod.VERY_LONG);
} catch (WaitTimeoutExpiredException ex) {
fail("There should be a running application pod for a deployed docker image, " + "but it does not exist.");
}
new OpenShiftExplorerView().getOpenShift3Connection(openshiftConnectionRequirement.getConnection()).refresh();
new OpenShiftExplorerView().getOpenShift3Connection(openshiftConnectionRequirement.getConnection()).getProject(projectName).getOpenShiftResources(Resource.ROUTE).get(0).select();
new ContextMenuItem(OpenShiftLabel.ContextMenu.SHOW_IN_BROWSER).select();
try {
// getRouteURL("hello-openshift", projectName),
new WaitUntil(new BrowserContainsText("Hello OpenShift!"), TimePeriod.VERY_LONG);
} catch (WaitTimeoutExpiredException ex) {
fail("Browser does not contain hello world content.");
}
}
use of org.hamcrest.core.StringContains in project nextprot-api by calipho-sib.
the class XMLWebTest method shouldGetXmlWellFormatted.
@Test
public void shouldGetXmlWellFormatted() throws Exception {
ResultActions result = this.mockMvc.perform(get("/entry/NX_P01308.xml"));
result.andExpect(xpath("//publication[@id='28338750']").exists());
// β-sheets
result.andExpect(content().string(new StringContains("β-sheets")));
}
use of org.hamcrest.core.StringContains in project nakadi by zalando.
the class EventTypeControllerTest method whenPostOptionsRetentionTimeSmallerThanMin.
@Test
public void whenPostOptionsRetentionTimeSmallerThanMin() throws Exception {
final EventType defaultEventType = TestUtils.buildDefaultEventType();
defaultEventType.getOptions().setRetentionTime(1079999L);
postEventType(defaultEventType).andExpect(status().is4xxClientError()).andExpect(content().string(new StringContains("Field \\\"options.retention_time\\\" can not be less than 10800000")));
}
Aggregations