Skip to content

Commit 858d302

Browse files
DX-3295, DX-3296 BXML and Response Verbs
1 parent 155aa6a commit 858d302

File tree

3 files changed

+97
-1
lines changed

3 files changed

+97
-1
lines changed

src/main/java/org/openapitools/client/model/bxml/Bxml.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,4 @@ public Bxml() {
1111
public Bxml(List<Verb> nestedVerbs) {
1212
super("Bxml", nestedVerbs);
1313
}
14-
}
14+
}
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
package org.openapitools.client.model.unit.bxml;
2+
3+
import org.openapitools.client.model.bxml.Verb;
4+
import org.openapitools.client.model.bxml.Bxml;
5+
6+
import java.util.ArrayList;
7+
import java.util.Arrays;
8+
9+
import org.junit.Test;
10+
11+
import static org.hamcrest.MatcherAssert.assertThat;
12+
import static org.hamcrest.CoreMatchers.instanceOf;
13+
import static org.hamcrest.Matchers.is;
14+
15+
16+
public class BxmlVerbTest {
17+
18+
/**
19+
* Setting up Variables
20+
*/
21+
ArrayList<Verb> nestedVerbs;
22+
Bxml bxml = new Bxml();
23+
Bxml bxml2 = new Bxml(Arrays.asList(new Verb("TestVerb1", "test"), new Verb("TestVerb2")));
24+
Verb verb1 = new Verb("TestVerb1", "test");
25+
Verb verb2 = new Verb("TestVerb2");
26+
Verb verb3 = new Verb("TestVerb3");
27+
28+
/**
29+
*
30+
*
31+
* Unit tests for Bxml Root Verb Class
32+
*
33+
* @throws Exception if the test fails
34+
*/
35+
36+
@Test
37+
public void testBxml() throws Exception {
38+
bxml.addVerb(verb1);
39+
bxml.addVerb(verb2);
40+
String expectedBxml = "<?xml version='1.0' encoding='UTF-8'?><Bxml><TestVerb1>test</TestVerb1><TestVerb2/></Bxml>";
41+
42+
assertThat(bxml.getVerb(0), instanceOf(Verb.class));
43+
assertThat(bxml.length(), is(2));
44+
assertThat(bxml.toBxml(), is(expectedBxml));
45+
assertThat(bxml2.length(), is(2));
46+
assertThat(bxml2.toBxml(), is(expectedBxml));
47+
};
48+
};
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
package org.openapitools.client.model.unit.bxml;
2+
3+
import org.openapitools.client.model.bxml.Verb;
4+
import org.openapitools.client.model.bxml.Response;
5+
6+
import java.util.ArrayList;
7+
import java.util.Arrays;
8+
9+
import org.junit.Test;
10+
11+
import static org.hamcrest.MatcherAssert.assertThat;
12+
import static org.hamcrest.CoreMatchers.instanceOf;
13+
import static org.hamcrest.Matchers.is;
14+
15+
16+
public class ResponseVerbTest {
17+
18+
/**
19+
* Setting up Variables
20+
*/
21+
ArrayList<Verb> nestedVerbs;
22+
Response response = new Response();
23+
Response response2 = new Response(Arrays.asList(new Verb("TestVerb1", "test"), new Verb("TestVerb2")));
24+
Verb verb1 = new Verb("TestVerb1", "test");
25+
Verb verb2 = new Verb("TestVerb2");
26+
Verb verb3 = new Verb("TestVerb3");
27+
28+
/**
29+
*
30+
*
31+
* Unit tests for Response Root Verb Class
32+
*
33+
* @throws Exception if the test fails
34+
*/
35+
36+
@Test
37+
public void testResponse() throws Exception {
38+
response.addVerb(verb1);
39+
response.addVerb(verb2);
40+
String expectedBxml = "<?xml version='1.0' encoding='UTF-8'?><Response><TestVerb1>test</TestVerb1><TestVerb2/></Response>";
41+
42+
assertThat(response.getVerb(0), instanceOf(Verb.class));
43+
assertThat(response.length(), is(2));
44+
assertThat(response.toBxml(), is(expectedBxml));
45+
assertThat(response2.length(), is(2));
46+
assertThat(response2.toBxml(), is(expectedBxml));
47+
};
48+
};

0 commit comments

Comments
 (0)