2 * Copyright (c) 2016 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
8 package org.opendaylight.mdsal.common.api.clustering;
10 import static org.junit.Assert.assertEquals;
11 import static org.junit.Assert.assertFalse;
12 import static org.junit.Assert.assertTrue;
13 import static org.mockito.Mockito.doReturn;
14 import static org.mockito.Mockito.mock;
16 import org.junit.Test;
18 public class GenericEntityOwnershipChangeTest {
21 public void basicTest() throws Exception {
22 final GenericEntity genericEntity = mock(GenericEntity.class);
23 doReturn("testEntity").when(genericEntity).toString();
24 final GenericEntityOwnershipChange genericEntityOwnershipChange =
25 new GenericEntityOwnershipChange(genericEntity, EntityOwnershipChangeState.LOCAL_OWNERSHIP_GRANTED);
27 assertEquals(genericEntity, genericEntityOwnershipChange.getEntity());
28 assertEquals(EntityOwnershipChangeState.LOCAL_OWNERSHIP_GRANTED, genericEntityOwnershipChange.getState());
29 assertFalse(genericEntityOwnershipChange.inJeopardy());
30 assertTrue(genericEntityOwnershipChange.toString().contains("testEntity"));