forked from loafle/openapi-generator-original
Fix tests on date format by using custom date format
This commit is contained in:
parent
e3c44b5af3
commit
55bcceac07
@ -8,6 +8,7 @@ import io.swagger.client.auth.*;
|
||||
import io.swagger.client.model.*;
|
||||
|
||||
import java.util.Map;
|
||||
import java.text.SimpleDateFormat;
|
||||
|
||||
import org.junit.*;
|
||||
import static org.junit.Assert.*;
|
||||
@ -21,6 +22,8 @@ public class StoreApiTest {
|
||||
// setup authentication
|
||||
ApiKeyAuth apiKeyAuth = (ApiKeyAuth) api.getApiClient().getAuthentication("api_key");
|
||||
apiKeyAuth.setApiKey("special-key");
|
||||
// set custom date format that is used by the petstore server
|
||||
api.getApiClient().setDateFormat(new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ"));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -8,6 +8,7 @@ import io.swagger.client.auth.*;
|
||||
import io.swagger.client.model.*;
|
||||
|
||||
import java.util.Map;
|
||||
import java.text.SimpleDateFormat;
|
||||
|
||||
import org.junit.*;
|
||||
import static org.junit.Assert.*;
|
||||
@ -21,6 +22,8 @@ public class StoreApiTest {
|
||||
// setup authentication
|
||||
ApiKeyAuth apiKeyAuth = (ApiKeyAuth) api.getApiClient().getAuthentication("api_key");
|
||||
apiKeyAuth.setApiKey("special-key");
|
||||
// set custom date format that is used by the petstore server
|
||||
api.getApiClient().setDateFormat(new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ"));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -8,6 +8,7 @@ import io.swagger.client.auth.*;
|
||||
import io.swagger.client.model.*;
|
||||
|
||||
import java.util.Map;
|
||||
import java.text.SimpleDateFormat;
|
||||
|
||||
import org.junit.*;
|
||||
import static org.junit.Assert.*;
|
||||
@ -21,6 +22,10 @@ public class StoreApiTest {
|
||||
// setup authentication
|
||||
ApiKeyAuth apiKeyAuth = (ApiKeyAuth) api.getApiClient().getAuthentication("api_key");
|
||||
apiKeyAuth.setApiKey("special-key");
|
||||
// set custom date format that is used by the petstore server
|
||||
// Note: it would still work without this setting as okhttp-gson Java client supports
|
||||
// various date formats by default, including the one used by petstore server
|
||||
api.getApiClient().setDateFormat(new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ"));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
Loading…
x
Reference in New Issue
Block a user