Search in sources :

Example 1 with StringContains

use of org.hamcrest.text.StringContains in project motech by motech.

the class BrokerStatisticsControllerTest method shouldReturnMessageInformationGivenQueueName.

@Test
public void shouldReturnMessageInformationGivenQueueName() throws Exception {
    given(mBeanService.getQueueMessages("foo")).willReturn(Arrays.asList(new QueueMessage("123", false, new DateTime())));
    mockMvc.perform(MockMvcRequestBuilders.get("/queues/browse?queueName=foo")).andExpect(status().isOk()).andExpect(content().string(new StringContains("\"messageId\":\"123"))).andExpect(content().string(new StringContains("\"redelivered\":false")));
}
Also used : QueueMessage(org.motechproject.admin.domain.QueueMessage) DateTime(org.joda.time.DateTime) StringContains(org.hamcrest.text.StringContains) Test(org.junit.Test)

Example 2 with StringContains

use of org.hamcrest.text.StringContains in project HotswapAgent by HotswapProjects.

the class AgentLoggerHandlerTest method testHandler.

@Test
public void testHandler() {
    AgentLoggerHandler handler = new AgentLoggerHandler();
    handler.setPrintStream(printStream);
    context.checking(new Expectations() {

        {
            oneOf(printStream).println(with(new StringContains("DEBUG (org.hotswap.agent.config.PluginManager) - A 1 B 2 C 3")));
        }
    });
    handler.print(PluginManager.class, AgentLogger.Level.DEBUG, "A {} B {} C {}", null, "1", 2, 3L);
}
Also used : Expectations(org.jmock.Expectations) StringContains(org.hamcrest.text.StringContains) Test(org.junit.Test)

Example 3 with StringContains

use of org.hamcrest.text.StringContains in project motech by motech.

the class BrokerStatisticsControllerTest method shouldReturnAllQueueInformation.

@Test
public void shouldReturnAllQueueInformation() throws Exception {
    given(mBeanService.getQueueStatistics()).willReturn(Arrays.asList(new QueueMBean("queue-1"), new QueueMBean("queue-2")));
    mockMvc.perform(MockMvcRequestBuilders.get("/queues")).andExpect(status().isOk()).andExpect(content().string(new StringContains("\"destination\":\"queue-1\""))).andExpect(content().string(new StringContains("\"destination\":\"queue-2\"")));
}
Also used : QueueMBean(org.motechproject.admin.domain.QueueMBean) StringContains(org.hamcrest.text.StringContains) Test(org.junit.Test)

Example 4 with StringContains

use of org.hamcrest.text.StringContains in project motech by motech.

the class BrokerStatisticsControllerTest method shouldReturnAllTopicInformation.

@Test
public void shouldReturnAllTopicInformation() throws Exception {
    given(mBeanService.getTopicStatistics()).willReturn(Arrays.asList(new TopicMBean("topic-1"), new TopicMBean("topic-2")));
    mockMvc.perform(MockMvcRequestBuilders.get("/topics")).andExpect(status().isOk()).andExpect(content().string(new StringContains("\"destination\":\"topic-1\""))).andExpect(content().string(new StringContains("\"destination\":\"topic-2\"")));
}
Also used : TopicMBean(org.motechproject.admin.domain.TopicMBean) StringContains(org.hamcrest.text.StringContains) Test(org.junit.Test)

Aggregations

StringContains (org.hamcrest.text.StringContains)4 Test (org.junit.Test)4 Expectations (org.jmock.Expectations)1 DateTime (org.joda.time.DateTime)1 QueueMBean (org.motechproject.admin.domain.QueueMBean)1 QueueMessage (org.motechproject.admin.domain.QueueMessage)1 TopicMBean (org.motechproject.admin.domain.TopicMBean)1