mirror of
https://github.com/sismics/docs.git
synced 2024-06-26 19:41:24 +02:00
36 lines
1.1 KiB
Java
36 lines
1.1 KiB
Java
|
package com.sismics.docs.rest;
|
||
|
|
||
|
import junit.framework.Assert;
|
||
|
|
||
|
import org.codehaus.jettison.json.JSONArray;
|
||
|
import org.codehaus.jettison.json.JSONException;
|
||
|
import org.codehaus.jettison.json.JSONObject;
|
||
|
import org.junit.Test;
|
||
|
|
||
|
import com.sismics.docs.rest.BaseJerseyTest;
|
||
|
import com.sun.jersey.api.client.ClientResponse;
|
||
|
import com.sun.jersey.api.client.ClientResponse.Status;
|
||
|
import com.sun.jersey.api.client.WebResource;
|
||
|
|
||
|
/**
|
||
|
* Test the locale resource.
|
||
|
*
|
||
|
* @author jtremeaux
|
||
|
*/
|
||
|
public class TestLocaleResource extends BaseJerseyTest {
|
||
|
/**
|
||
|
* Test the locale resource.
|
||
|
*
|
||
|
* @throws JSONException
|
||
|
*/
|
||
|
@Test
|
||
|
public void testLocaleResource() throws JSONException {
|
||
|
WebResource localeResource = resource().path("/locale");
|
||
|
ClientResponse response = localeResource.get(ClientResponse.class);
|
||
|
response = localeResource.get(ClientResponse.class);
|
||
|
Assert.assertEquals(Status.OK, Status.fromStatusCode(response.getStatus()));
|
||
|
JSONObject json = response.getEntity(JSONObject.class);
|
||
|
JSONArray locale = json.getJSONArray("locales");
|
||
|
Assert.assertTrue(locale.length() > 0);
|
||
|
}
|
||
|
}
|