Example usage for org.springframework.aop TargetSource getClass

List of usage examples for org.springframework.aop TargetSource getClass

Introduction

In this page you can find the example usage for org.springframework.aop TargetSource getClass.

Prototype

@HotSpotIntrinsicCandidate
public final native Class<?> getClass();

Source Link

Document

Returns the runtime class of this Object .

Usage

From source file:org.springmodules.cache.interceptor.proxy.CacheProxyFactoryBeanTests.java

/**
 * Verifies that the method//from w w w .ja  v  a2 s  . c o m
 * <code>{@link CacheProxyFactoryBean#getObjectType()}</code> returns the
 * class of the target if:
 * <ul>
 * <li>The proxy is <code>null</code>.</li>
 * <li>The target is not <code>null</code> and it is an instance of
 * <code>org.springframework.aop.TargetSource</code>.</li>
 * </ul>
 */
public void testGetObjectTypeWhenProxyIsNullAndTargetIsNotNullAndTargetIsInstanceOfTargetSource() {
    TargetSource instanceOfTargetSource = EmptyTargetSource.INSTANCE;
    factoryBean.setTarget(instanceOfTargetSource);
    // verify that the proxy is null before running the method to test.
    assertNull(factoryBean.getProxy());
    assertEquals(instanceOfTargetSource.getClass(), factoryBean.getObjectType());
}