Package org.lightfish.business.servermonitoring.control.collectors

Examples of org.lightfish.business.servermonitoring.control.collectors.DataCollector.collect()


    @Test
    public void action_all_good() throws Exception {
        DataCollector collector = mock(DataCollector.class);
        DataPoint expectedResult = mock(DataPoint.class);
        when(collector.collect()).thenReturn(expectedResult);
        Future compute = action.compute(collector);
        assertEquals(expectedResult, compute.get());
    }

    @Test
View Full Code Here


    @Test
    public void action_with_retry() throws Exception {
        DataCollector collector = mock(DataCollector.class);
        DataPoint expectedResult = mock(DataPoint.class);
        when(collector.collect())
                .thenThrow(new Exception("Ahh!!"))
                .thenReturn(expectedResult);
        Future compute = action.compute(collector);
        assertEquals(expectedResult, compute.get());
    }
View Full Code Here

    }

    @Test
    public void action_that_fails() throws Exception {
        DataCollector collector = mock(DataCollector.class);
        when(collector.collect())
                .thenThrow(new Exception("Ahh!!"))
                .thenThrow(new Exception("Another Ahh!!"));
        Future compute = action.compute(collector);
        assertNull(compute.get());
        assertEquals("Another Ahh!!", action.getThrownException().getMessage());
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.