forked from karatelabs/karate
-
Notifications
You must be signed in to change notification settings - Fork 0
/
JavaApiTest.java
38 lines (32 loc) · 1.06 KB
/
JavaApiTest.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
package demo.java;
import com.intuit.karate.Runner;
import java.util.HashMap;
import java.util.Map;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.*;
/**
*
* @author pthomas3
*/
class JavaApiTest {
@BeforeAll
static void beforeAll() {
// skip 'callSingle' in karate-config.js
System.setProperty("karate.env", "mock");
}
@Test
void testCallingFeatureFromJava() {
Map<String, Object> args = new HashMap();
args.put("name", "World");
Map<String, Object> result = Runner.runFeature(getClass(), "from-java.feature", args, true);
assertEquals("Hello World", result.get("greeting"));
}
@Test
void testCallingClasspathFeatureFromJava() {
Map<String, Object> args = new HashMap();
args.put("name", "World");
Map<String, Object> result = Runner.runFeature("classpath:demo/java/from-java.feature", args, true);
assertEquals("Hello World", result.get("greeting"));
}
}