Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test(ZNTA-2297): transunithistory returns bad request on null localei…
…d or transunitid
- Loading branch information
efloden
committed
Feb 28, 2018
1 parent
4d8ec1b
commit 380e991
Showing
2 changed files
with
49 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
...er/services/src/test/java/org/zanata/rest/editor/service/TransUnitHistoryServiceTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package org.zanata.rest.editor.service; | ||
|
||
import org.junit.Before; | ||
import org.junit.Test; | ||
import org.mockito.Mock; | ||
import org.mockito.MockitoAnnotations; | ||
import org.zanata.webtrans.server.rpc.GetTranslationHistoryHandler; | ||
import org.zanata.webtrans.shared.rpc.GetTranslationHistoryResult; | ||
|
||
import javax.ws.rs.core.Response; | ||
|
||
import static org.assertj.core.api.Assertions.assertThat; | ||
|
||
public class TransUnitHistoryServiceTest { | ||
private TransUnitHistoryService service; | ||
@Mock | ||
private GetTranslationHistoryHandler historyHandler; | ||
|
||
@Before | ||
public void setUp() throws Exception { | ||
MockitoAnnotations.initMocks(this); | ||
historyHandler = new GetTranslationHistoryHandler(); | ||
service = new TransUnitHistoryService(historyHandler); | ||
} | ||
|
||
@Test | ||
public void nullOrEmptyLocaleWillReturnBadRequest() { | ||
Long transUnitID = 1L; | ||
Response response = service.get(null, transUnitID); | ||
assertThat(response.getStatus()).isEqualTo(400); | ||
} | ||
|
||
@Test | ||
public void nullTransUnitIdWillReturnBadRequest() { | ||
String localeId = "ja"; | ||
Response response = service.get(localeId, null); | ||
assertThat(response.getStatus()).isEqualTo(400); | ||
} | ||
} |