Skip navigation links
NLPCraft 0.5.1

Package org.nlpcraft.model.test

Contains model testing framework.

See: Description

Package org.nlpcraft.model.test Description

Contains model testing framework.

Here's an code snippet from Alarm Clock example illustrating the usage of test framework together with JUnit 5:
 public class AlarmTest {
     private NCTestClient client;

     @BeforeEach
     void setUp() throws NCException, IOException {
         client = new NCTestClientBuilder().newBuilder().build();

         client.open("nlpcraft.alarm.ex");
     }

     @AfterEach
     void tearDown() throws NCException, IOException {
         client.close();
     }

     @Test
     public void test() throws NCException, IOException {
         // Empty parameter.
         assertTrue(client.ask("").isFailed());

         // Only latin charset is supported.
         assertTrue(client.ask("El tiempo en EspaƱa").isFailed());

         // Should be passed.
         assertTrue(client.ask("Ping me in 3 minutes").isSuccessful());
         assertTrue(client.ask("Buzz me in an hour and 15mins").isSuccessful());
         assertTrue(client.ask("Set my alarm for 30s").isSuccessful());
     }
 }
 
Skip navigation links
NLPCraft 0.5.1 Examples Star Fork

Copyright © 2013-2019 NLPCraft Project. All rights reserved.