Skip to content

Commit d707421

Browse files
committed
Update unit tests
1 parent 622b5c1 commit d707421

File tree

2 files changed

+48
-42
lines changed

2 files changed

+48
-42
lines changed
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
package io.swagger.client;
2+
3+
import static org.junit.Assert.*;
4+
import org.junit.*;
5+
6+
public class ApiClientTest {
7+
ApiClient apiClient = null;
8+
9+
@Before
10+
public void setup() {
11+
apiClient = new ApiClient();
12+
}
13+
@Test
14+
public void testSelectHeaderAccept() {
15+
String[] accepts = { "APPLICATION/JSON", "APPLICATION/XML" };
16+
assertEquals("application/json", apiClient.selectHeaderAccept(accepts));
17+
18+
accepts = new String[] { "application/json", "application/xml" };
19+
assertEquals("application/json", apiClient.selectHeaderAccept(accepts));
20+
21+
accepts = new String[] { "application/xml", "application/json" };
22+
assertEquals("application/json", apiClient.selectHeaderAccept(accepts));
23+
24+
accepts = new String[] { "text/plain", "application/xml" };
25+
assertEquals("text/plain,application/xml", apiClient.selectHeaderAccept(accepts));
26+
27+
accepts = new String[] { };
28+
assertNull(apiClient.selectHeaderAccept(accepts));
29+
}
30+
31+
@Test
32+
public void testSelectHeaderContentType() {
33+
String[] contentTypes = { "APPLICATION/JSON", "APPLICATION/XML" };
34+
assertEquals("application/json", apiClient.selectHeaderContentType(contentTypes));
35+
36+
contentTypes = new String[] { "application/json", "application/xml" };
37+
assertEquals("application/json", apiClient.selectHeaderContentType(contentTypes));
38+
39+
contentTypes = new String[] { "application/xml", "application/json" };
40+
assertEquals("application/json", apiClient.selectHeaderContentType(contentTypes));
41+
42+
contentTypes = new String[] { "text/plain", "application/xml" };
43+
assertEquals("text/plain", apiClient.selectHeaderContentType(contentTypes));
44+
45+
contentTypes = new String[] { };
46+
assertEquals("application/json", apiClient.selectHeaderContentType(contentTypes));
47+
}
48+
}

samples/client/petstore/java/src/test/java/io/swagger/client/ApiInvokerTest.java

Lines changed: 0 additions & 42 deletions
This file was deleted.

0 commit comments

Comments
 (0)