Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,15 @@ public interface StringsApi extends AutoCloseable
@Path("/projects/{projectUid}/source-strings")
SourceStringListPTO getSourceStrings(@PathParam("projectUid") String projectUid, @BeanParam GetSourceStringsCommandPTO sourceStringsCommand);

@POST
@Path("/projects/{projectUid}/source-strings")
SourceStringListPTO getSourceStringsPost(@PathParam("projectUid") String projectUid, GetSourceStringsCommandPTO sourceStringsCommand);

@GET
@Path("/projects/{projectUid}/translations")
ListResponse<TranslationsPTO> getTranslations(@PathParam("projectUid") String projectUid, @BeanParam TranslationsCommandPTO translationsCommand);

@POST
@Path("/projects/{projectUid}/translations")
ListResponse<TranslationsPTO> getTranslationsPost(@PathParam("projectUid") String projectUid, TranslationsCommandPTO translationsCommand);
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@

import javax.ws.rs.core.HttpHeaders;

import static org.junit.Assert.*;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;

public class StringsApiTest
{
Expand Down Expand Up @@ -195,6 +197,18 @@ public void testGetSourceStrings() throws Exception
assertTrue(request.getPath().contains("/projects/" + PROJECT_UID + "/source-strings"));
}

@Test
public void getSourceStringsPost() throws Exception
{
assignResponse(HttpStatus.SC_OK, SOURCE_STRINGS);

SourceStringListPTO sourceStrings = stringsApi.getSourceStringsPost(PROJECT_UID, new GetSourceStringsCommandPTO());
assertNotNull(sourceStrings);
RecordedRequest request = mockWebServer.takeRequest();
assertEquals("POST", request.getMethod());
assertTrue(request.getPath().contains("/projects/" + PROJECT_UID + "/source-strings"));
}

@Test
public void testGetTranslations() throws Exception
{
Expand All @@ -206,4 +220,16 @@ public void testGetTranslations() throws Exception
assertEquals("GET", request.getMethod());
assertTrue(request.getPath().contains("/projects/" + PROJECT_UID + "/translations"));
}

@Test
public void testGetTranslationsPost() throws Exception
{
assignResponse(HttpStatus.SC_OK, TRANSLATIONS);

ListResponse<TranslationsPTO> translations = stringsApi.getTranslationsPost(PROJECT_UID, new TranslationsCommandPTO());
assertNotNull(translations);
RecordedRequest request = mockWebServer.takeRequest();
assertEquals("POST", request.getMethod());
assertTrue(request.getPath().contains("/projects/" + PROJECT_UID + "/translations"));
}
}