Search in sources :

Example 26 with StringContains

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());
}
Also used : ShellIsAvailable(org.eclipse.reddeer.swt.condition.ShellIsAvailable) FinishButton(org.eclipse.reddeer.swt.impl.button.FinishButton) WaitWhile(org.eclipse.reddeer.common.wait.WaitWhile) ServerAdapterExists(org.jboss.tools.openshift.reddeer.condition.ServerAdapterExists) WaitTimeoutExpiredException(org.eclipse.reddeer.common.exception.WaitTimeoutExpiredException) JobIsKilled(org.eclipse.reddeer.workbench.core.condition.JobIsKilled) JobIsRunning(org.eclipse.reddeer.workbench.core.condition.JobIsRunning) WaitUntil(org.eclipse.reddeer.common.wait.WaitUntil) StringContains(org.hamcrest.core.StringContains)

Example 27 with StringContains

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")));
}
Also used : ResultActions(org.springframework.test.web.servlet.ResultActions) StringContains(org.hamcrest.core.StringContains) MVCBaseSecurityIntegrationTest(org.nextprot.api.web.dbunit.base.mvc.MVCBaseSecurityIntegrationTest) Test(org.junit.Test)

Example 28 with StringContains

use of org.hamcrest.core.StringContains in project cactoos by yegor256.

the class UncheckedTextTest method rethrowsCheckedToUncheckedException.

@Test
void rethrowsCheckedToUncheckedException() {
    final String msg = "intended";
    new Assertion<>("Must throw an exception when something goes wrong", new UncheckedText(() -> {
        throw new IOException(msg);
    })::asString, new Throws<>(new StringContains(msg), RuntimeException.class)).affirm();
}
Also used : HasToString(org.hamcrest.object.HasToString) IOException(java.io.IOException) Throws(org.llorllale.cactoos.matchers.Throws) StringContains(org.hamcrest.core.StringContains) Test(org.junit.jupiter.api.Test)

Example 29 with StringContains

use of org.hamcrest.core.StringContains in project sling by apache.

the class GetPostTest method testValidGet.

@Test
public void testValidGet() throws ClientException, URISyntaxException {
    MicrodataHtmlClient client = new MicrodataHtmlClient(httpServer.getURI().toString());
    Document doc = client.get(GET_URL);
    Assert.assertThat("GET request failed", doc.toString(), new StringContains(OK_RESPONSE));
}
Also used : MicrodataHtmlClient(org.apache.sling.hapi.client.impl.microdata.MicrodataHtmlClient) Document(org.apache.sling.hapi.client.Document) StringContains(org.hamcrest.core.StringContains) Test(org.junit.Test)

Example 30 with StringContains

use of org.hamcrest.core.StringContains in project verify-hub by alphagov.

the class TransactionConfigEntityDataTest method shouldThrowExceptionWhenLoadingConfigFileWithInvalidUserAccountAttributes.

@Test
public void shouldThrowExceptionWhenLoadingConfigFileWithInvalidUserAccountAttributes() throws IOException {
    String badAttribute = "[ \"FIRST_NAME\", \"FIRST_NAME_VERIFIED\", \"INVALID_ATTRIBUTE\" ]";
    InputStream badAttributeStream = new ByteArrayInputStream(badAttribute.getBytes());
    ObjectMapper mapper = new ObjectMapper();
    exception.expect(InvalidFormatException.class);
    StringContains matcher = new StringContains("\"INVALID_ATTRIBUTE\": value not one of declared Enum instance names: [MIDDLE_NAME_VERIFIED, MIDDLE_NAME, DATE_OF_BIRTH, CURRENT_ADDRESS_VERIFIED, FIRST_NAME, SURNAME, SURNAME_VERIFIED, FIRST_NAME_VERIFIED, CURRENT_ADDRESS, DATE_OF_BIRTH_VERIFIED, ADDRESS_HISTORY, CYCLE_3]");
    exception.expectMessage(matcher);
    mapper.readValue(badAttributeStream, mapper.getTypeFactory().constructCollectionType(List.class, UserAccountCreationAttribute.class));
}
Also used : ByteArrayInputStream(java.io.ByteArrayInputStream) ByteArrayInputStream(java.io.ByteArrayInputStream) InputStream(java.io.InputStream) List(java.util.List) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) StringContains(org.hamcrest.core.StringContains) Test(org.junit.Test)

Aggregations

StringContains (org.hamcrest.core.StringContains)58 Test (org.junit.Test)25 Test (org.junit.jupiter.api.Test)22 ContainerResultMatcher (com.artipie.test.ContainerResultMatcher)14 IsEqual (org.hamcrest.core.IsEqual)12 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)8 TestResource (com.artipie.asto.test.TestResource)7 Path (java.nio.file.Path)7 WaitUntil (org.eclipse.reddeer.common.wait.WaitUntil)7 StringContainsInOrder (org.hamcrest.text.StringContainsInOrder)6 SettingsCaches (com.artipie.cache.SettingsCaches)5 ByteArrayOutputStream (java.io.ByteArrayOutputStream)5 Logger (java.util.logging.Logger)5 WaitTimeoutExpiredException (org.eclipse.reddeer.common.exception.WaitTimeoutExpiredException)5 AllOf (org.hamcrest.core.AllOf)5 TestDeployment (com.artipie.test.TestDeployment)4 IOException (java.io.IOException)4 OutputStream (java.io.OutputStream)4 OS (org.junit.jupiter.api.condition.OS)4 LengthOf (org.cactoos.scalar.LengthOf)3