-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: improve 'report' package code coverage (#244)
- Loading branch information
1 parent
631beda
commit d7b75c4
Showing
11 changed files
with
242 additions
and
83 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
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,34 @@ | ||
package com.crowdin.client.reports.model; | ||
|
||
import com.crowdin.client.core.model.EnumConverter; | ||
|
||
public enum Mode implements EnumConverter<Mode> { | ||
|
||
NO_MATCH("no_match"), | ||
PERFECT("perfect"), | ||
OPTION_100("100"), | ||
OPTION_99_95("99-95"), | ||
OPTION_94_90("94-90"), | ||
OPTION_89_80("89-80"); | ||
|
||
private final String val; | ||
|
||
Mode(String val) { | ||
this.val = val; | ||
} | ||
|
||
public static Mode from(String value) { | ||
for (Mode mode : Mode.values()) { | ||
if (mode.val.equals(value)) { | ||
return mode; | ||
} | ||
} | ||
return null; | ||
} | ||
|
||
@Override | ||
public String to(Mode v) { | ||
return v.val; | ||
} | ||
|
||
} |
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 |
---|---|---|
|
@@ -4,6 +4,5 @@ | |
|
||
@Data | ||
public class ReportStatusResponseObject { | ||
|
||
private ReportStatus data; | ||
} |
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
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
55 changes: 55 additions & 0 deletions
55
...java/com/crowdin/client/reports/model/CostEstimateFuzzyModeGenerateReportRequestTest.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,55 @@ | ||
package com.crowdin.client.reports.model; | ||
|
||
import org.junit.jupiter.api.Test; | ||
|
||
import static org.junit.jupiter.api.Assertions.*; | ||
|
||
class CostEstimateFuzzyModeGenerateReportRequestTest { | ||
|
||
@Test | ||
void from() { | ||
Mode response = Mode.from("perfect"); | ||
assertEquals(Mode.PERFECT, response); | ||
|
||
Mode response1 = Mode.from("100"); | ||
assertEquals(Mode.OPTION_100, response1); | ||
|
||
Mode response2 = Mode.from("99-95"); | ||
assertEquals(Mode.OPTION_99_95, response2); | ||
|
||
Mode response3 = Mode.from("94-90"); | ||
assertEquals(Mode.OPTION_94_90, response3); | ||
|
||
Mode response4 = Mode.from("89-80"); | ||
assertEquals(Mode.OPTION_89_80, response4); | ||
|
||
Mode response5 = Mode.from("no_match"); | ||
assertEquals(Mode.NO_MATCH, response5); | ||
|
||
Mode response6 = Mode.from("do_not_match"); | ||
assertNull(response6); | ||
|
||
} | ||
|
||
@Test | ||
void to() { | ||
Object response = (Mode.PERFECT).to(Mode.PERFECT); | ||
assertEquals(response, "perfect"); | ||
|
||
Object response1 = (Mode.NO_MATCH).to(Mode.NO_MATCH); | ||
assertEquals(response1, "no_match"); | ||
|
||
Object response2 = (Mode.OPTION_100).to(Mode.OPTION_100); | ||
assertEquals(response2, "100"); | ||
|
||
Object response3 = (Mode.OPTION_89_80).to(Mode.OPTION_89_80); | ||
assertEquals(response3, "89-80"); | ||
|
||
Object response4 = (Mode.OPTION_94_90).to(Mode.OPTION_94_90); | ||
assertEquals(response4, "94-90"); | ||
|
||
Object response5 = (Mode.OPTION_99_95).to(Mode.OPTION_99_95); | ||
assertEquals(response5, "99-95"); | ||
} | ||
|
||
} |
26 changes: 26 additions & 0 deletions
26
src/test/java/com/crowdin/client/reports/model/GroupingParameterTest.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,26 @@ | ||
package com.crowdin.client.reports.model; | ||
|
||
import org.junit.jupiter.api.Test; | ||
|
||
import static org.junit.jupiter.api.Assertions.*; | ||
|
||
class GroupingParameterTest { | ||
|
||
@Test | ||
void from() { | ||
GroupingParameter response = GroupingParameter.from("user"); | ||
assertEquals(GroupingParameter.USER, response); | ||
|
||
GroupingParameter response1 = GroupingParameter.from("language"); | ||
assertEquals(GroupingParameter.LANGUAGE, response1); | ||
} | ||
|
||
@Test | ||
void to() { | ||
Object response = (GroupingParameter.USER).to(GroupingParameter.USER); | ||
assertEquals(response, "user"); | ||
|
||
Object response1 = (GroupingParameter.LANGUAGE).to(GroupingParameter.LANGUAGE); | ||
assertEquals(response1, "language"); | ||
} | ||
} |
26 changes: 26 additions & 0 deletions
26
src/test/java/com/crowdin/client/reports/model/LabelIncludeTypeTest.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,26 @@ | ||
package com.crowdin.client.reports.model; | ||
|
||
import org.junit.jupiter.api.Test; | ||
|
||
import static org.junit.jupiter.api.Assertions.*; | ||
|
||
class LabelIncludeTypeTest { | ||
|
||
@Test | ||
void from() { | ||
LabelIncludeType response = LabelIncludeType.from("strings_with_label"); | ||
assertEquals(LabelIncludeType.STRINGS_WITH_LABEL, response); | ||
|
||
LabelIncludeType response1 = LabelIncludeType.from("strings_without_label"); | ||
assertEquals(LabelIncludeType.STRINGS_WITHOUT_LABEL, response1); | ||
} | ||
|
||
@Test | ||
void to() { | ||
Object response = (LabelIncludeType.STRINGS_WITH_LABEL).to(LabelIncludeType.STRINGS_WITH_LABEL); | ||
assertEquals(response, "strings_with_label"); | ||
|
||
Object response1 = (LabelIncludeType.STRINGS_WITHOUT_LABEL).to(LabelIncludeType.STRINGS_WITHOUT_LABEL); | ||
assertEquals(response1, "strings_without_label"); | ||
} | ||
} |
42 changes: 42 additions & 0 deletions
42
src/test/java/com/crowdin/client/reports/model/MatchTypeTest.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,42 @@ | ||
package com.crowdin.client.reports.model; | ||
|
||
import org.junit.jupiter.api.Test; | ||
|
||
import static org.junit.jupiter.api.Assertions.*; | ||
|
||
class MatchTypeTest { | ||
|
||
@Test | ||
void from() { | ||
MatchType response = MatchType.from("perfect"); | ||
assertEquals(MatchType.PERFECT, response); | ||
|
||
MatchType response1 = MatchType.from("100"); | ||
assertEquals(MatchType.OPTION_100, response1); | ||
|
||
MatchType response2 = MatchType.from("99-82"); | ||
assertEquals(MatchType.OPTION_99_82, response2); | ||
|
||
MatchType response3 = MatchType.from("81-60"); | ||
assertEquals(MatchType.OPTION_81_60, response3); | ||
|
||
MatchType response4 = MatchType.from("do_not_match"); | ||
assertNull(response4); | ||
|
||
} | ||
|
||
@Test | ||
void to() { | ||
Object response = (MatchType.PERFECT).to(MatchType.PERFECT); | ||
assertEquals(response, "perfect"); | ||
|
||
Object response1 = (MatchType.OPTION_100).to(MatchType.OPTION_100); | ||
assertEquals(response1, "100"); | ||
|
||
Object response2 = (MatchType.OPTION_99_82).to(MatchType.OPTION_99_82); | ||
assertEquals(response2, "99-82"); | ||
|
||
Object response3 = (MatchType.OPTION_81_60).to(MatchType.OPTION_81_60); | ||
assertEquals(response3, "81-60"); | ||
} | ||
} |
28 changes: 28 additions & 0 deletions
28
src/test/java/com/crowdin/client/reports/model/Reports2FormatTest.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,28 @@ | ||
package com.crowdin.client.reports.model; | ||
|
||
import org.junit.jupiter.api.Test; | ||
|
||
import static org.junit.jupiter.api.Assertions.*; | ||
|
||
class Reports2FormatTest { | ||
|
||
@Test | ||
void from() { | ||
Reports2Format response = Reports2Format.from("xlsx"); | ||
assertEquals(Reports2Format.XLSX, response); | ||
|
||
Reports2Format response1 = Reports2Format.from("csv"); | ||
assertEquals(Reports2Format.CSV, response1); | ||
|
||
} | ||
|
||
@Test | ||
void to() { | ||
Object response = (Reports2Format.XLSX).to(Reports2Format.XLSX); | ||
assertEquals(response, "xlsx"); | ||
|
||
Object response1 = (Reports2Format.CSV).to(Reports2Format.CSV); | ||
assertEquals(response1, "csv"); | ||
} | ||
|
||
} |
29 changes: 29 additions & 0 deletions
29
src/test/java/com/crowdin/client/reports/model/TranslationCostGenerateReportRequestTest.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,29 @@ | ||
package com.crowdin.client.reports.model; | ||
|
||
import org.junit.jupiter.api.Test; | ||
|
||
import static org.junit.jupiter.api.Assertions.*; | ||
|
||
class TranslationCostGenerateReportRequestTest { | ||
|
||
@Test | ||
void from() { | ||
|
||
TranslationCostGenerateReportRequest.Mode response = TranslationCostGenerateReportRequest.Mode.from("no_match"); | ||
assertEquals(TranslationCostGenerateReportRequest.Mode.NO_MATCH, response); | ||
|
||
TranslationCostGenerateReportRequest.Mode response2 = TranslationCostGenerateReportRequest.Mode.from("tm_match"); | ||
assertEquals(TranslationCostGenerateReportRequest.Mode.TM_MATCH, response2); | ||
|
||
} | ||
|
||
@Test | ||
void to() { | ||
Object response = (TranslationCostGenerateReportRequest.Mode.TM_MATCH).to(TranslationCostGenerateReportRequest.Mode.TM_MATCH); | ||
assertEquals(response, "tm_match"); | ||
|
||
Object response1 = (TranslationCostGenerateReportRequest.Mode.NO_MATCH).to(TranslationCostGenerateReportRequest.Mode.NO_MATCH); | ||
assertEquals(response1, "no_match"); | ||
} | ||
|
||
} |