From: Robert Varga Date: Thu, 7 Feb 2019 13:38:48 +0000 (+0100) Subject: Remove useless tests X-Git-Tag: release/neon~1 X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=commitdiff_plain;h=2fa46c041043e1ab10755531e679db1fe792a733;p=ovsdb.git Remove useless tests These tests are not asserting anything at all, remove them to reduce static mocking proliferation for no value whatsoever. Change-Id: I53b21da97d7b9c7cf6e64543e6fe73f2c08267e9 JIRA: OVSDB-476 Signed-off-by: Robert Varga (cherry picked from commit 4a6fd54eedf2f7275d43ac4da351b5c3abf8302d) --- diff --git a/southbound/southbound-impl/src/test/java/org/opendaylight/ovsdb/southbound/ovsdb/transact/BridgeRemovedCommandTest.java b/southbound/southbound-impl/src/test/java/org/opendaylight/ovsdb/southbound/ovsdb/transact/BridgeRemovedCommandTest.java deleted file mode 100644 index e5b4be33b..000000000 --- a/southbound/southbound-impl/src/test/java/org/opendaylight/ovsdb/southbound/ovsdb/transact/BridgeRemovedCommandTest.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright (c) 2015 Inocybe Technologies. and others. All rights reserved. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/epl-v10.html - */ - -package org.opendaylight.ovsdb.southbound.ovsdb.transact; - -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; - -import java.util.HashMap; -import java.util.HashSet; -import java.util.Map; -import java.util.Set; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.mockito.Mock; -import org.mockito.Mockito; -import org.opendaylight.ovsdb.lib.operations.TransactionBuilder; -import org.opendaylight.ovsdb.southbound.InstanceIdentifierCodec; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.OvsdbBridgeAugmentation; -import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; -import org.powermock.api.mockito.PowerMockito; -import org.powermock.core.classloader.annotations.PrepareForTest; -import org.powermock.modules.junit4.PowerMockRunner; - -@PrepareForTest({BridgeRemovedCommand.class, TransactUtils.class}) -@RunWith(PowerMockRunner.class) -public class BridgeRemovedCommandTest { - - private BridgeRemovedCommand briRemovedCmd = new BridgeRemovedCommand(); - @Mock private DataChangeEvent changes; - @Mock private DataChangeEvent returnChanges; - private final Set> removed = new HashSet<>(); - private final Map, OvsdbBridgeAugmentation> originals = new HashMap<>(); - - @Before - public void setUp() throws Exception { - briRemovedCmd = mock(BridgeRemovedCommand.class, Mockito.CALLS_REAL_METHODS); - } - - @Test - public void testExecute() throws Exception { - PowerMockito.mockStatic(TransactUtils.class); - when(TransactUtils.extractRemoved(changes, OvsdbBridgeAugmentation.class)).thenReturn(removed); - when(TransactUtils.extractOriginal(changes, OvsdbBridgeAugmentation.class)).thenReturn(originals); - - TransactionBuilder transaction = mock(TransactionBuilder.class, Mockito.RETURNS_MOCKS); - briRemovedCmd.execute(transaction, mock(BridgeOperationalState.class), changes, - mock(InstanceIdentifierCodec.class)); - - // TODO Actually verify something - } - -} diff --git a/southbound/southbound-impl/src/test/java/org/opendaylight/ovsdb/southbound/ovsdb/transact/BridgeUpdateCommandTest.java b/southbound/southbound-impl/src/test/java/org/opendaylight/ovsdb/southbound/ovsdb/transact/BridgeUpdateCommandTest.java deleted file mode 100644 index 0b3a1c52d..000000000 --- a/southbound/southbound-impl/src/test/java/org/opendaylight/ovsdb/southbound/ovsdb/transact/BridgeUpdateCommandTest.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright (c) 2015 Inocybe Technologies. and others. All rights reserved. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/epl-v10.html - */ - -package org.opendaylight.ovsdb.southbound.ovsdb.transact; - -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; - -import java.util.Map; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.mockito.Mock; -import org.mockito.Mockito; -import org.opendaylight.ovsdb.lib.operations.TransactionBuilder; -import org.opendaylight.ovsdb.southbound.InstanceIdentifierCodec; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.OvsdbBridgeAugmentation; -import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; -import org.powermock.api.mockito.PowerMockito; -import org.powermock.core.classloader.annotations.PrepareForTest; -import org.powermock.modules.junit4.PowerMockRunner; - -@PrepareForTest({BridgeUpdateCommand.class, TransactUtils.class}) -@RunWith(PowerMockRunner.class) -public class BridgeUpdateCommandTest { - - @Mock private BridgeUpdateCommand briUpdatedCmd; - @Mock private DataChangeEvent changes; - @Mock private DataChangeEvent returnChanges; - @Mock private Map, OvsdbBridgeAugmentation> created; - @Mock private Map, OvsdbBridgeAugmentation> updated; - - @Before - public void setUp() throws Exception { - briUpdatedCmd = mock(BridgeUpdateCommand.class, Mockito.CALLS_REAL_METHODS); - } - - @Test - public void testExecute() { - PowerMockito.mockStatic(TransactUtils.class); - when(TransactUtils.extractCreated(changes, OvsdbBridgeAugmentation.class)).thenReturn(created); - when(TransactUtils.extractUpdated(changes, OvsdbBridgeAugmentation.class)).thenReturn(updated); - - TransactionBuilder transaction = mock(TransactionBuilder.class, Mockito.RETURNS_MOCKS); - briUpdatedCmd.execute(transaction, mock(BridgeOperationalState.class), changes, - mock(InstanceIdentifierCodec.class)); - - // TODO Actually verify something - } - -} diff --git a/southbound/southbound-impl/src/test/java/org/opendaylight/ovsdb/southbound/ovsdb/transact/ControllerRemovedCommandTest.java b/southbound/southbound-impl/src/test/java/org/opendaylight/ovsdb/southbound/ovsdb/transact/ControllerRemovedCommandTest.java deleted file mode 100644 index 24534ed83..000000000 --- a/southbound/southbound-impl/src/test/java/org/opendaylight/ovsdb/southbound/ovsdb/transact/ControllerRemovedCommandTest.java +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright (c) 2015 Inocybe Technologies. and others. All rights reserved. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/epl-v10.html - */ - -package org.opendaylight.ovsdb.southbound.ovsdb.transact; - -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; - -import java.util.HashMap; -import java.util.HashSet; -import java.util.Map; -import java.util.Set; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.mockito.Mock; -import org.mockito.Mockito; -import org.opendaylight.ovsdb.lib.operations.TransactionBuilder; -import org.opendaylight.ovsdb.southbound.InstanceIdentifierCodec; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.OvsdbBridgeAugmentation; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.ovsdb.bridge.attributes.ControllerEntry; -import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; -import org.powermock.api.mockito.PowerMockito; -import org.powermock.core.classloader.annotations.PrepareForTest; -import org.powermock.modules.junit4.PowerMockRunner; - -@PrepareForTest({ControllerRemovedCommand.class, TransactUtils.class}) -@RunWith(PowerMockRunner.class) -public class ControllerRemovedCommandTest { - - private ControllerRemovedCommand contRemoveCmd = new ControllerRemovedCommand(); - @Mock private DataChangeEvent changes; - @Mock private DataChangeEvent returnChanges; - private final Set> removed = new HashSet<>(); - private final Map, ControllerEntry> operationalControllerEntries = - new HashMap<>(); - private final Map, OvsdbBridgeAugmentation> created = new HashMap<>(); - private final Map, OvsdbBridgeAugmentation> updated = new HashMap<>(); - - @Before - public void setUp() throws Exception { - contRemoveCmd = mock(ControllerRemovedCommand.class, Mockito.CALLS_REAL_METHODS); - } - - @Test - public void testExecute() throws Exception { - PowerMockito.mockStatic(TransactUtils.class); - when(TransactUtils.extractRemoved(changes, ControllerEntry.class)).thenReturn(removed); - when(TransactUtils.extractOriginal(changes, ControllerEntry.class)).thenReturn(operationalControllerEntries); - when(TransactUtils.extractCreated(changes, OvsdbBridgeAugmentation.class)).thenReturn(created); - when(TransactUtils.extractUpdated(changes, OvsdbBridgeAugmentation.class)).thenReturn(updated); - - TransactionBuilder transaction = mock(TransactionBuilder.class, Mockito.RETURNS_MOCKS); - contRemoveCmd.execute(transaction, null, changes, mock(InstanceIdentifierCodec.class)); - - // TODO Actually verify something - } - -} diff --git a/southbound/southbound-impl/src/test/java/org/opendaylight/ovsdb/southbound/ovsdb/transact/ControllerUpdateCommandTest.java b/southbound/southbound-impl/src/test/java/org/opendaylight/ovsdb/southbound/ovsdb/transact/ControllerUpdateCommandTest.java deleted file mode 100644 index 10fc58a29..000000000 --- a/southbound/southbound-impl/src/test/java/org/opendaylight/ovsdb/southbound/ovsdb/transact/ControllerUpdateCommandTest.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright (c) 2015 Inocybe Technologies. and others. All rights reserved. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/epl-v10.html - */ -package org.opendaylight.ovsdb.southbound.ovsdb.transact; - -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; - -import java.util.Map; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.mockito.Mock; -import org.mockito.Mockito; -import org.opendaylight.ovsdb.lib.operations.TransactionBuilder; -import org.opendaylight.ovsdb.southbound.InstanceIdentifierCodec; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.OvsdbBridgeAugmentation; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.ovsdb.bridge.attributes.ControllerEntry; -import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; -import org.powermock.api.mockito.PowerMockito; -import org.powermock.core.classloader.annotations.PrepareForTest; -import org.powermock.modules.junit4.PowerMockRunner; - -@PrepareForTest({ControllerUpdateCommand.class, TransactUtils.class}) -@RunWith(PowerMockRunner.class) -public class ControllerUpdateCommandTest { - - @Mock private ControllerUpdateCommand contUpdateCmd; - @Mock private DataChangeEvent changes; - @Mock private DataChangeEvent returnChanges; - @Mock private Map, ControllerEntry> controllers; - @Mock private Map, OvsdbBridgeAugmentation> bridges; - - @Before - public void setUp() throws Exception { - contUpdateCmd = mock(ControllerUpdateCommand.class, Mockito.CALLS_REAL_METHODS); - } - - @Test - public void testExecute() { - PowerMockito.mockStatic(TransactUtils.class); - when(TransactUtils.extractCreated(changes, ControllerEntry.class)).thenReturn(controllers); - when(TransactUtils.extractUpdated(changes, OvsdbBridgeAugmentation.class)).thenReturn(bridges); - - TransactionBuilder transaction = mock(TransactionBuilder.class, Mockito.RETURNS_MOCKS); - contUpdateCmd.execute(transaction, mock(BridgeOperationalState.class), changes, - mock(InstanceIdentifierCodec.class)); - - // TODO Actually verify something - } - -}