2 * Copyright (c) 2015 Brocade Communications 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
8 package org.opendaylight.mdsal.common.api.clustering;
10 import static org.junit.Assert.assertEquals;
11 import org.junit.Test;
14 * Unit tests for EntityOwnershipChangeState.
16 * @author Thomas Pantelis
18 public class EntityOwnershipChangeStateTest {
21 public void testFromWithValid() {
22 assertEquals("from(false, true, true)", EntityOwnershipChangeState.LOCAL_OWNERSHIP_GRANTED,
23 EntityOwnershipChangeState.from(false, true, true));
24 assertEquals("from(true, false, true)", EntityOwnershipChangeState.LOCAL_OWNERSHIP_LOST_NEW_OWNER,
25 EntityOwnershipChangeState.from(true, false, true));
26 assertEquals("from(true, false, false)", EntityOwnershipChangeState.LOCAL_OWNERSHIP_LOST_NO_OWNER,
27 EntityOwnershipChangeState.from(true, false, false));
28 assertEquals("from(false, false, true)", EntityOwnershipChangeState.REMOTE_OWNERSHIP_CHANGED,
29 EntityOwnershipChangeState.from(false, false, true));
30 assertEquals("from(false, false, false)", EntityOwnershipChangeState.REMOTE_OWNERSHIP_LOST_NO_OWNER,
31 EntityOwnershipChangeState.from(false, false, false));
34 @Test(expected=IllegalArgumentException.class)
35 public void testFromWithInvalidFalseTrueFalse() {
36 EntityOwnershipChangeState.from(false, true, false);
39 @Test(expected=IllegalArgumentException.class)
40 public void testFromWithInvalidTrueTrueFalse() {
41 EntityOwnershipChangeState.from(true, true, false);
44 @Test(expected=IllegalArgumentException.class)
45 public void testFromWithInvalidTrueTrueTrue() {
46 EntityOwnershipChangeState.from(true, true, true);