2 * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
9 package org.opendaylight.openflowplugin.openflow.md.core;
11 import static org.mockito.Mockito.when;
13 import junit.framework.TestCase;
14 import org.junit.Before;
15 import org.junit.Test;
16 import org.mockito.MockitoAnnotations;
17 import org.opendaylight.openflowplugin.ConnectionException;
18 import org.opendaylight.openflowplugin.api.openflow.md.core.ErrorHandler;
19 import org.opendaylight.openflowplugin.api.openflow.md.core.session.SessionContext;
20 import org.opendaylight.openflowplugin.api.openflow.md.core.session.SwitchSessionKeyOF;
22 public class ErrorHandlerSimpleImplTest extends TestCase {
24 ErrorHandler errorHandler = new ErrorHandlerSimpleImpl();
26 @MockitoAnnotations.Mock
27 SessionContext sessionContext;
29 @MockitoAnnotations.Mock
30 SwitchSessionKeyOF switchSessionKeyOF;
34 when(sessionContext.getSessionKey()).thenReturn(switchSessionKeyOF);
35 when(switchSessionKeyOF.getId()).thenReturn(new byte[0]);
39 public void testHandleException() throws Exception {
40 ConnectionException connectionException = new ConnectionException("Exception for testing purpose only.");
41 errorHandler.handleException(connectionException, sessionContext);
43 Exception someException = new Exception("Exception for testing purpose only.");
44 errorHandler.handleException(someException, sessionContext);