X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fsal-distributed-datastore%2Fsrc%2Ftest%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fcluster%2Fdatastore%2Fshardstrategy%2FShardStrategyFactoryTest.java;h=a7310903a7c7d206bc96ada0affe67ae84a3fe35;hp=e7b70e8c1e84171f63328d2050d1ecae86bcbc03;hb=dcc776a5e749d495a66e8753e123a1ddbd15d9c6;hpb=c1336f9b497bc6867536a24f629c3f0b002ccb2f diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/shardstrategy/ShardStrategyFactoryTest.java b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/shardstrategy/ShardStrategyFactoryTest.java index e7b70e8c1e..a7310903a7 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/shardstrategy/ShardStrategyFactoryTest.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/shardstrategy/ShardStrategyFactoryTest.java @@ -5,33 +5,26 @@ * 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.controller.cluster.datastore.shardstrategy; +import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertThrows; import static org.junit.Assert.assertTrue; import org.junit.Before; -import org.junit.Rule; import org.junit.Test; -import org.junit.rules.ExpectedException; import org.opendaylight.controller.cluster.datastore.config.ConfigurationImpl; import org.opendaylight.controller.md.cluster.datastore.model.CarsModel; import org.opendaylight.controller.md.cluster.datastore.model.TestModel; -import org.opendaylight.mdsal.common.api.LogicalDatastoreType; import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier; public class ShardStrategyFactoryTest { - - ShardStrategyFactory factory; - - @Rule - public ExpectedException expectedEx = ExpectedException.none(); + private ShardStrategyFactory factory; @Before public void setUp() { - factory = new ShardStrategyFactory( - new ConfigurationImpl("module-shards.conf", "modules.conf"), LogicalDatastoreType.CONFIGURATION); + factory = new ShardStrategyFactory(new ConfigurationImpl("module-shards.conf", "modules.conf")); } @Test @@ -46,12 +39,9 @@ public class ShardStrategyFactoryTest { assertTrue(strategy instanceof ModuleShardStrategy); } - @Test public void testGetStrategyNullPointerExceptionWhenPathIsNull() { - expectedEx.expect(NullPointerException.class); - expectedEx.expectMessage("path should not be null"); - - factory.getStrategy(null); + final NullPointerException ex = assertThrows(NullPointerException.class, () -> factory.getStrategy(null)); + assertEquals("path should not be null", ex.getMessage()); } }