This is an automated email from the ASF dual-hosted git repository.
sergeykamov pushed a commit to branch NLPCRAFT-283
in repository https://gitbox.apache.org/repos/asf/incubator-nlpcraft.git
The following commit(s) were added to refs/heads/NLPCRAFT-283 by this push:
new 911402a WIP.
911402a is described below
commit 911402a1880edcf1437ac628158256b6ea2ca2db
Author: Sergey Kamov <[email protected]>
AuthorDate: Thu Mar 25 17:41:01 2021 +0300
WIP.
---
.../nlpcraft/model/dialog/NCDialogSpec2.scala | 25 +++++++++++++++-------
1 file changed, 17 insertions(+), 8 deletions(-)
diff --git
a/nlpcraft/src/test/scala/org/apache/nlpcraft/model/dialog/NCDialogSpec2.scala
b/nlpcraft/src/test/scala/org/apache/nlpcraft/model/dialog/NCDialogSpec2.scala
index 4a42136..982384c 100644
---
a/nlpcraft/src/test/scala/org/apache/nlpcraft/model/dialog/NCDialogSpec2.scala
+++
b/nlpcraft/src/test/scala/org/apache/nlpcraft/model/dialog/NCDialogSpec2.scala
@@ -27,8 +27,10 @@ import java.util
* Test model.
*/
class NCDialogSpecModelFlow2 {
- def invalidDef1(flow: java.util.List[NCDialogFlowItem]): String = null
+ def invalidDef1(flow: java.util.List[NCDialogFlowItem]): String = "string"
def invalidDef2(): Boolean = true
+ def invalidDef3(flow: java.util.List[NCDialogFlowItem]): Boolean = throw
new IllegalStateException()
+ def invalidDef4(flow: java.util.List[NCDialogFlowItem]): Boolean = null
def validDef(flow: java.util.List[NCDialogFlowItem]): Boolean = true
}
@@ -37,16 +39,22 @@ class NCDialogSpecModel2 extends NCModel {
override def getName: String = this.getClass.getSimpleName
override def getVersion: String = "1.0.0"
- override def getElements: util.Set[NCElement] = Set(NCTestElement("a1"),
NCTestElement("a2"), NCTestElement("a3"))
+ override def getElements: util.Set[NCElement] = Set((for (i ← 1 to 9)
yield NCTestElement(s"a$i")):_*)
- @NCIntent("intent=onA1
flow=/org.apache.nlpcraft.model.dialog.NCDialogSpecModelFlow2#invalidDef2/
term~{id() == 'a1'}")
+ @NCIntent("intent=onA1
flow=/org.apache.nlpcraft.model.dialog.NCDialogSpecModelFlow2#invalidDef1/
term~{id() == 'a1'}")
def onA1(): NCResult = NCResult.text("ok")
- @NCIntent("intent=onA2
flow=/org.apache.nlpcraft.model.dialog.NCDialogSpecModelFlow2#validDef/
term~{id() == 'a2'}")
+ @NCIntent("intent=onA2
flow=/org.apache.nlpcraft.model.dialog.NCDialogSpecModelFlow2#invalidDef2/
term~{id() == 'a2'}")
def onA2(): NCResult = NCResult.text("ok")
- @NCIntent("intent=onA3
flow=/org.apache.nlpcraft.model.dialog.NCDialogSpecModelFlow2#validDef/
term~{id() == 'a3'}")
+ @NCIntent("intent=onA3
flow=/org.apache.nlpcraft.model.dialog.NCDialogSpecModelFlow2#invalidDef3/
term~{id() == 'a3'}")
def onA3(): NCResult = NCResult.text("ok")
+
+ @NCIntent("intent=onA4
flow=/org.apache.nlpcraft.model.dialog.NCDialogSpecModelFlow2#invalidDef4/
term~{id() == 'a4'}")
+ def onA4(): NCResult = NCResult.text("ok")
+
+ @NCIntent("intent=onA5
flow=/org.apache.nlpcraft.model.dialog.NCDialogSpecModelFlow2#validDef/
term~{id() == 'a5'}")
+ def onA5(): NCResult = NCResult.text("ok")
}
/**
@@ -56,9 +64,10 @@ class NCDialogSpecModel2 extends NCModel {
class NCDialogSpec2 extends NCTestContext {
@Test
private[dialog] def test(): Unit = {
- require(getClient.ask("a1").isFailed)
- require(getClient.ask("a2").isFailed)
+ def fail(txts: String*): Unit = txts.foreach(txt ⇒
require(getClient.ask(txt).isFailed))
+
+ fail("a1", "a2", "a3", "a4")
- checkIntent("a3", "onA3")
+ checkIntent("a5", "onA5")
}
}