MCPcopy Create free account
hub / github.com/BaseXdb/basex / RESTTest

Class RESTTest

basex-api/src/test/java/org/basex/http/rest/RESTTest.java:15–49  ·  view source on GitHub ↗

This class tests the embedded REST API. @author BaseX Team, BSD License @author Christian Gruen

Source from the content-addressed store, hash-verified

13 * @author Christian Gruen
14 */
15public abstract class RESTTest extends HTTPTest {
16 /** REST URI. */
17 static final String URI = Token.string(RESTText.REST_URI);
18 /** Input file. */
19 static final String FILE = "src/test/resources/input.xml";
20
21 // INITIALIZERS =================================================================================
22
23 /**
24 * Start server.
25 * @throws Exception exception
26 */
27 @BeforeAll public static void start() throws Exception {
28 init(REST_ROOT, true);
29 }
30
31 /**
32 * Checks if a string starts with another.
33 * @param string full string
34 * @param prefix prefix
35 */
36 protected static void assertStartsWith(final String string, final String prefix) {
37 assertTrue(string.startsWith(prefix),
38 '\'' + string + "' does not start with '" + prefix + '\'');
39 }
40
41 /**
42 * Checks if a string is contained in another string.
43 * @param str string
44 * @param sub sub string
45 */
46 protected static void assertContains(final String str, final String sub) {
47 if(!str.contains(sub)) fail('\'' + sub + "' not contained in '" + str + "'.");
48 }
49}

Callers

nothing calls this directly

Calls 1

stringMethod · 0.95

Tested by

no test coverage detected