mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-10-08 14:51:49 +00:00
125603 rmunteanu: Merged 5.1.1 (5.1.1) to 5.1.N (5.1.2) 125484 slanglois: MNT-16155 Update source headers - remove old Copyrights from Java and JSP dource files git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/DEV/5.2.N/root@125781 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
46 lines
1.5 KiB
Java
46 lines
1.5 KiB
Java
package org.alfresco.repo.audit;
|
|
|
|
import java.lang.reflect.Method;
|
|
|
|
import junit.framework.TestCase;
|
|
|
|
import org.alfresco.service.Auditable;
|
|
|
|
/**
|
|
* @author Andy Hind
|
|
*/
|
|
public class AuditableAnnotationTest extends TestCase
|
|
{
|
|
|
|
public AuditableAnnotationTest()
|
|
{
|
|
super();
|
|
}
|
|
|
|
@SuppressWarnings("unchecked")
|
|
public void testAnnotations() throws Exception, NoSuchMethodException
|
|
{
|
|
Class clazz = AnnotationTestInterface.class;
|
|
|
|
Method method = clazz.getMethod("noArgs", new Class[]{});
|
|
assertTrue(method.isAnnotationPresent(Auditable.class));
|
|
Auditable auditable = method.getAnnotation(Auditable.class);
|
|
assertEquals(auditable.parameters().length, 0);
|
|
|
|
|
|
method = clazz.getMethod("getString", new Class[]{String.class, String.class});
|
|
assertTrue(method.isAnnotationPresent(Auditable.class));
|
|
auditable = method.getAnnotation(Auditable.class);
|
|
assertEquals(auditable.parameters().length, 2);
|
|
assertEquals(auditable.parameters()[0], "one");
|
|
assertEquals(auditable.parameters()[1], "two");
|
|
|
|
|
|
method = clazz.getMethod("getAnotherString", new Class[]{String.class});
|
|
assertTrue(method.isAnnotationPresent(Auditable.class));
|
|
auditable = method.getAnnotation(Auditable.class);
|
|
assertEquals(auditable.parameters().length, 1);
|
|
assertEquals(auditable.parameters()[0], "one");
|
|
}
|
|
}
|