Package org.aspectj.lang

Examples of org.aspectj.lang.ProceedingJoinPoint.proceed()


    @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

    }

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

        // Test monitor without pre-existing perf monitor.
        aspect.monitor(mockPjp, mockAnnotation);
View Full Code Here

        aspect.monitor(mockPjp, mockAnnotation);

        String otherMonitor = "OtherMonitor";

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

        PerformanceMonitor otherMockAnnotation = createMock(PerformanceMonitor.class);
        expect(otherMockAnnotation.value()).andReturn(otherMonitor);
        replay(otherMockAnnotation);
View Full Code Here

    }

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

        PerformanceMonitorFactory factory = new PerformanceMonitorFactory();
        aspect.setPerformanceMonitorFactory(factory);
View Full Code Here

    @Test(expected = Throwable.class)
    public void testMonitorWithThrowable() throws Throwable {

        ProceedingJoinPoint mockPjp = createPjpMock(mockSignature, 1);
        expect(mockPjp.proceed()).andThrow(new Throwable());
        replay(mockPjp);

        aspect.monitor(mockPjp, mockAnnotation);
        verifyMonitor(TEST_MONITOR, 0, 1);
View Full Code Here

    }

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

        aspect.monitor(mockPjp, mockAnnotation);
        verifyMonitor(TEST_MONITOR, 0, 1);
View Full Code Here

    ProceedingJoinPoint targetMethod = EasyMock.createMock(ProceedingJoinPoint.class);

    EasyMock.expect(targetMethod.getSignature()).andReturn(signature);
    EasyMock.expect(signature.getDeclaringType()).andReturn(Object.class);
    EasyMock.expect(signature.getName()).andReturn("hashCode");
    EasyMock.expect(targetMethod.proceed()).andReturn(new Object());

    EasyMock.replay(signature, targetMethod);
    performanceMonitor.monitor(targetMethod);
    EasyMock.verify(signature, targetMethod);
  }
View Full Code Here

        .createMock(ProceedingJoinPoint.class);

    EasyMock.expect(targetMethod.getSignature()).andReturn(signature);
    EasyMock.expect(signature.getDeclaringType()).andReturn(Object.class);
    EasyMock.expect(signature.getName()).andReturn("hashCode");
    EasyMock.expect(targetMethod.proceed()).andReturn(new Object());

    EasyMock.replay(signature, targetMethod);
    performanceMonitor.monitor(targetMethod);
    EasyMock.verify(signature, targetMethod);
  }
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.