forked from loafle/openapi-generator-original
Update unit tests
This commit is contained in:
parent
622b5c179a
commit
d70742119b
@ -0,0 +1,48 @@
|
|||||||
|
package io.swagger.client;
|
||||||
|
|
||||||
|
import static org.junit.Assert.*;
|
||||||
|
import org.junit.*;
|
||||||
|
|
||||||
|
public class ApiClientTest {
|
||||||
|
ApiClient apiClient = null;
|
||||||
|
|
||||||
|
@Before
|
||||||
|
public void setup() {
|
||||||
|
apiClient = new ApiClient();
|
||||||
|
}
|
||||||
|
@Test
|
||||||
|
public void testSelectHeaderAccept() {
|
||||||
|
String[] accepts = { "APPLICATION/JSON", "APPLICATION/XML" };
|
||||||
|
assertEquals("application/json", apiClient.selectHeaderAccept(accepts));
|
||||||
|
|
||||||
|
accepts = new String[] { "application/json", "application/xml" };
|
||||||
|
assertEquals("application/json", apiClient.selectHeaderAccept(accepts));
|
||||||
|
|
||||||
|
accepts = new String[] { "application/xml", "application/json" };
|
||||||
|
assertEquals("application/json", apiClient.selectHeaderAccept(accepts));
|
||||||
|
|
||||||
|
accepts = new String[] { "text/plain", "application/xml" };
|
||||||
|
assertEquals("text/plain,application/xml", apiClient.selectHeaderAccept(accepts));
|
||||||
|
|
||||||
|
accepts = new String[] { };
|
||||||
|
assertNull(apiClient.selectHeaderAccept(accepts));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testSelectHeaderContentType() {
|
||||||
|
String[] contentTypes = { "APPLICATION/JSON", "APPLICATION/XML" };
|
||||||
|
assertEquals("application/json", apiClient.selectHeaderContentType(contentTypes));
|
||||||
|
|
||||||
|
contentTypes = new String[] { "application/json", "application/xml" };
|
||||||
|
assertEquals("application/json", apiClient.selectHeaderContentType(contentTypes));
|
||||||
|
|
||||||
|
contentTypes = new String[] { "application/xml", "application/json" };
|
||||||
|
assertEquals("application/json", apiClient.selectHeaderContentType(contentTypes));
|
||||||
|
|
||||||
|
contentTypes = new String[] { "text/plain", "application/xml" };
|
||||||
|
assertEquals("text/plain", apiClient.selectHeaderContentType(contentTypes));
|
||||||
|
|
||||||
|
contentTypes = new String[] { };
|
||||||
|
assertEquals("application/json", apiClient.selectHeaderContentType(contentTypes));
|
||||||
|
}
|
||||||
|
}
|
@ -1,42 +0,0 @@
|
|||||||
package io.swagger.client;
|
|
||||||
|
|
||||||
import static org.junit.Assert.*;
|
|
||||||
import org.junit.*;
|
|
||||||
|
|
||||||
public class ApiInvokerTest {
|
|
||||||
@Test
|
|
||||||
public void testSelectHeaderAccept() {
|
|
||||||
String[] accepts = { "APPLICATION/JSON", "APPLICATION/XML" };
|
|
||||||
assertEquals("application/json", ApiInvoker.selectHeaderAccept(accepts));
|
|
||||||
|
|
||||||
accepts = new String[] { "application/json", "application/xml" };
|
|
||||||
assertEquals("application/json", ApiInvoker.selectHeaderAccept(accepts));
|
|
||||||
|
|
||||||
accepts = new String[] { "application/xml", "application/json" };
|
|
||||||
assertEquals("application/json", ApiInvoker.selectHeaderAccept(accepts));
|
|
||||||
|
|
||||||
accepts = new String[] { "text/plain", "application/xml" };
|
|
||||||
assertEquals("text/plain,application/xml", ApiInvoker.selectHeaderAccept(accepts));
|
|
||||||
|
|
||||||
accepts = new String[] { };
|
|
||||||
assertNull(ApiInvoker.selectHeaderAccept(accepts));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testSelectHeaderContentType() {
|
|
||||||
String[] contentTypes = { "APPLICATION/JSON", "APPLICATION/XML" };
|
|
||||||
assertEquals("application/json", ApiInvoker.selectHeaderContentType(contentTypes));
|
|
||||||
|
|
||||||
contentTypes = new String[] { "application/json", "application/xml" };
|
|
||||||
assertEquals("application/json", ApiInvoker.selectHeaderContentType(contentTypes));
|
|
||||||
|
|
||||||
contentTypes = new String[] { "application/xml", "application/json" };
|
|
||||||
assertEquals("application/json", ApiInvoker.selectHeaderContentType(contentTypes));
|
|
||||||
|
|
||||||
contentTypes = new String[] { "text/plain", "application/xml" };
|
|
||||||
assertEquals("text/plain", ApiInvoker.selectHeaderContentType(contentTypes));
|
|
||||||
|
|
||||||
contentTypes = new String[] { };
|
|
||||||
assertEquals("application/json", ApiInvoker.selectHeaderContentType(contentTypes));
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
x
Reference in New Issue
Block a user