From 173400997555315a3b45d16b1e1f5faed0275390 Mon Sep 17 00:00:00 2001 From: Nicole00 <16240361+Nicole00@users.noreply.github.com> Date: Wed, 21 Jul 2021 10:06:33 +0800 Subject: [PATCH] split multi test --- .../nebula/exchange/config/ConfigsSuite.scala | 68 +++++++++---------- 1 file changed, 33 insertions(+), 35 deletions(-) diff --git a/nebula-exchange/src/test/scala/com/vesoft/nebula/exchange/config/ConfigsSuite.scala b/nebula-exchange/src/test/scala/com/vesoft/nebula/exchange/config/ConfigsSuite.scala index 9c00e52f..8f86cdf8 100644 --- a/nebula-exchange/src/test/scala/com/vesoft/nebula/exchange/config/ConfigsSuite.scala +++ b/nebula-exchange/src/test/scala/com/vesoft/nebula/exchange/config/ConfigsSuite.scala @@ -23,6 +23,7 @@ import com.vesoft.nebula.exchange.config.{ import com.vesoft.nebula.exchange.{Argument, KeyPolicy} import org.apache.log4j.Logger import org.junit.Test +import org.scalatest.Assertions.assertThrows class ConfigsSuite { private[this] val LOG = Logger.getLogger(this.getClass) @@ -242,56 +243,53 @@ class ConfigsSuite { } } + /** + * correct config + */ @Test - def DataBaseConfigsSuite(): Unit = { - // correct config + def dataBaseConfigSuite(): Unit = { val graphAddress = List("127.0.0.1:9669", "127.0.0.1:9670") val metaAddress = List("127.0.0.1:9559", "127.0.0.1:9560") val space = "test" DataBaseConfigEntry(graphAddress, space, metaAddress) + } - // empty space - try { + /** + * empty space + */ + @Test + def dataBaseConfigEmptySpaceSuite: Unit = { + val graphAddress = List("127.0.0.1:9669", "127.0.0.1:9670") + val metaAddress = List("127.0.0.1:9559", "127.0.0.1:9560") + assertThrows[IllegalArgumentException] { DataBaseConfigEntry(graphAddress, "", metaAddress) - } catch { - case e: IllegalArgumentException => { - LOG.error("we expect here, ", e) - assert(true) - } - case e: Throwable => { - LOG.error("DataBaseConfigSuite failed, ", e) - assert(false) - } } + } - // wrong graph address + /** + * wrong graph address + */ + @Test + def dataBaseConfigWrongGraphSuite: Unit = { val wrongGraphAddress = List("127.0.0.1:9669,127.0.0.1:9670") - try { + val space = "test" + val metaAddress = List("127.0.0.1:9559", "127.0.0.1:9560") + + assertThrows[IllegalArgumentException] { DataBaseConfigEntry(wrongGraphAddress, space, metaAddress) - } catch { - case e: IllegalArgumentException => { - LOG.error("we expect here, ", e) - assert(true) - } - case e: Throwable => { - LOG.error("DataBaseConfigSuite failed, ", e) - assert(false) - } } + } - // wrong meta Address + /** + * wrong meta Address + */ + @Test + def dataBaseConfigWrongMetaSuite: Unit = { + val graphAddress = List("127.0.0.1:9669", "127.0.0.1:9670") + val space = "test" val wrongMetaAddress = List("127.0.0.1:9559,127.0.0.1:9560") - try { + assertThrows[IllegalArgumentException] { DataBaseConfigEntry(graphAddress, space, wrongMetaAddress) - } catch { - case e: IllegalArgumentException => { - LOG.error("we expect here, ", e) - assert(true) - } - case e: Throwable => { - LOG.error("DataBaseConfigSuite failed, ", e) - assert(false) - } } } }