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.eos.common.api;
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;
17 import org.opendaylight.mdsal.eos.common.api.EntityOwnershipChangeState;
18 import org.opendaylight.mdsal.eos.common.api.GenericEntity;
19 import org.opendaylight.mdsal.eos.common.api.GenericEntityOwnershipChange;
21 public class GenericEntityOwnershipChangeTest {
24 public void basicTest() throws Exception {
25 final GenericEntity genericEntity = mock(GenericEntity.class);
26 doReturn("testEntity").when(genericEntity).toString();
27 final GenericEntityOwnershipChange genericEntityOwnershipChange =
28 new GenericEntityOwnershipChange(genericEntity, EntityOwnershipChangeState.LOCAL_OWNERSHIP_GRANTED);
30 assertEquals(genericEntity, genericEntityOwnershipChange.getEntity());
31 assertEquals(EntityOwnershipChangeState.LOCAL_OWNERSHIP_GRANTED, genericEntityOwnershipChange.getState());
32 assertFalse(genericEntityOwnershipChange.inJeopardy());
33 assertTrue(genericEntityOwnershipChange.toString().contains("testEntity"));