📄 eventlistenertests.java
字号:
/* * Copyright 2004 The JA-SIG Collaborative. All rights reserved. See license * distributed with this file and available online at * http://www.ja-sig.org/products/cas/overview/license/ */package org.jasig.cas.event;import java.util.Arrays;import org.jasig.cas.TestUtils;import org.jasig.cas.authentication.handler.AuthenticationHandler;import org.jasig.cas.event.handlers.TestEventHandler;import org.jasig.cas.mock.MockApplicationEvent;import org.jasig.cas.mock.MockEventHandler;import org.springframework.context.ApplicationEvent;import junit.framework.TestCase;/** * @author Scott Battaglia * @version $Revision: 39690 $ $Date: 2007-04-07 14:35:03 -0400 (Sat, 07 Apr 2007) $ * @since 3.0 */public class EventListenerTests extends TestCase { private EventListener eventListener; protected void setUp() throws Exception { this.eventListener = new EventListener(); this.eventListener .setEventHandlers(Arrays.asList(new EventHandler[] {new TestEventHandler()})); } public void testHandlEvent() { AuthenticationEvent e = new AuthenticationEvent(TestUtils .getCredentialsWithSameUsernameAndPassword(), true, AuthenticationHandler.class); this.eventListener.onApplicationEvent(e); } public void testNoEventToHandle() { ApplicationEvent e = new MockApplicationEvent("Test"); this.eventListener.onApplicationEvent(e); } public void testNotHandlEvent() { AuthenticationEvent e = new AuthenticationEvent(TestUtils .getCredentialsWithSameUsernameAndPassword(), true, AuthenticationHandler.class); this.eventListener .setEventHandlers(Arrays.asList(new EventHandler[] {new MockEventHandler()})); this.eventListener.onApplicationEvent(e); }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -