Package org.aspectj.lang

Examples of org.aspectj.lang.ProceedingJoinPoint


    }

    @Test
    public void testMonitorWithError() throws Throwable {
        Error e = new Error();
        ProceedingJoinPoint mockPjp = createPjpMock(mockSignature, 1);
        expect(mockPjp.proceed()).andThrow(e);
        replay(mockPjp);

        callMonitorCatchThrowable(mockPjp, e);
        verifyBreakerExists(TEST_CIRCUIT_BREAKER);
View Full Code Here


        verify(mockSignature);
    }

    @Test
    public void testMonitorWithRunTimeException() throws Throwable {
        ProceedingJoinPoint mockPjp = createPjpMock(mockSignature, 1);
        expect(mockPjp.proceed()).andThrow(new Throwable());
        replay(mockPjp);

        callMonitorCatchThrowable(mockPjp, new RuntimeException());
        verifyBreakerExists(TEST_CIRCUIT_BREAKER);
View Full Code Here

    }

    @Test
    public void testMonitorWithException() throws Throwable {
        Exception e = new Exception();
        ProceedingJoinPoint mockPjp = createPjpMock(mockSignature, 1);
        expect(mockPjp.proceed()).andThrow(e);
        replay(mockPjp);

        callMonitorCatchThrowable(mockPjp, e);
        verifyBreakerExists(TEST_CIRCUIT_BREAKER);
View Full Code Here

    }

    @Test
    public void testGetCircuitBreakerFactory() throws Throwable {

        ProceedingJoinPoint mockPjp = createPjpMock(mockSignature, 1);
        expect(mockPjp.proceed()).andReturn(null);
        replay(mockPjp);

        aspect.monitor(mockPjp, mockAnnotation);
        CircuitBreakerFactory circuitBreakerFactory =
                aspect.getCircuitBreakerFactory();
View Full Code Here

    @Test
    public void testTripBreaker() throws Throwable {
        int pjpCallCount = 7;
        int callCount = pjpCallCount - 1;

        ProceedingJoinPoint mockPjp = createPjpMock(mockSignature, pjpCallCount);

        expect(mockPjp.proceed()).andThrow(new Exception()).times(callCount);
        replay(mockPjp);

        Exception e = new Exception();

        for (int i = 0; i < callCount; i++) {
View Full Code Here

        verify(mockAnnotation);
        verify(mockSignature);
    }

    private static ProceedingJoinPoint createPjpMock(Signature mockSignature, int times) {
        ProceedingJoinPoint mockPjp = createMock(ProceedingJoinPoint.class);
        // XXX: the following two interactions are for logging, so they may happen
        //      0 or n times, pending logging configuration
        expect(mockPjp.getTarget()).andReturn("Target").times(0, times);
        expect(mockPjp.getSignature()).andReturn(mockSignature).times(0, times);
        return mockPjp;
    }
View Full Code Here

        replay(mockSignature);
    }

    @Test
    public void testCall() throws Throwable {
        ProceedingJoinPoint mockPjp = createPjpMock(mockSignature);
        expect(mockPjp.proceed()).andReturn(null).times(1);
        replay(mockPjp);

        aspect.call(mockPjp, mockAnnotation);

        verify(mockPjp);
View Full Code Here

    @Test
    public void testCall_WithException() throws Throwable {
        Exception exception = new Exception();

        ProceedingJoinPoint mockPjp = createPjpMock(mockSignature);
        expect(mockPjp.proceed()).andThrow(exception);
        replay(mockPjp);

        callCatchThrowable(mockPjp, exception);

        verify(mockPjp);
View Full Code Here

    @Test
    public void testCall_WithError() throws Throwable {
        Error error = new Error();

        ProceedingJoinPoint mockPjp = createPjpMock(mockSignature);
        expect(mockPjp.proceed()).andThrow(error);
        replay(mockPjp);

        callCatchThrowable(mockPjp, error);

        verify(mockPjp);
View Full Code Here

    @Test
    public void testCall_WithThrowable() throws Throwable {
        Throwable throwable = new Throwable();

        ProceedingJoinPoint mockPjp = createPjpMock(mockSignature);
        expect(mockPjp.proceed()).andThrow(throwable);
        replay(mockPjp);

        callCatchThrowable(mockPjp, new RuntimeException(throwable));

        verify(mockPjp);
View Full Code Here

TOP

Related Classes of org.aspectj.lang.ProceedingJoinPoint

Copyright © 2018 www.massapicom. 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.