Add greek translations for Measurement provider & other Greek tests#1410
Conversation
PR Summary
These modifications serve to enhance user experience by catering to the needs of our Greek-speaking customers, especially in sectors where conversion between units is a frequent necessity. |
kingthorin
left a comment
There was a problem hiding this comment.
Could you add tests?
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #1410 +/- ##
============================================
+ Coverage 92.21% 92.25% +0.04%
- Complexity 3149 3151 +2
============================================
Files 319 319
Lines 6149 6149
Branches 591 591
============================================
+ Hits 5670 5673 +3
+ Misses 334 333 -1
+ Partials 145 143 -2 ☔ View full report in Codecov by Sentry. |
|
Hi @gvrettos , thank you for your contribution. Feel free to send them, but we won't be applying |
Hi @kingthorin!
Hi @bodiam! I am sorry if that got too frustrating for you. |
|
How about something like this? Suggested test changes (diff)diff --git a/src/test/java/net/datafaker/providers/base/BaseFakerTest.java b/src/test/java/net/datafaker/providers/base/BaseFakerTest.java
index 4f4a16d8..030045fd 100644
--- a/src/test/java/net/datafaker/providers/base/BaseFakerTest.java
+++ b/src/test/java/net/datafaker/providers/base/BaseFakerTest.java
@@ -22,7 +22,7 @@
public class BaseFakerTest<T extends BaseFaker> {
private static final Logger LOG = Logger.getLogger(BaseFakerTest.class.getCanonicalName());
- protected final T faker = getFaker();
+ protected T faker = getFaker();
@BeforeEach
@SuppressWarnings("EmptyTryBlock")
@@ -38,6 +38,10 @@ protected T getFaker() {
return (T) new BaseFaker();
}
+ protected void setFaker(T faker) {
+ this.faker = (T) faker;
+ }
+
protected List<String> getBaseList(String key) {
return faker.fakeValuesService().fetchObject(key, faker.getContext());
}
diff --git a/src/test/java/net/datafaker/providers/base/MeasurementTest.java b/src/test/java/net/datafaker/providers/base/MeasurementTest.java
index 6c759c66..e88239d0 100644
--- a/src/test/java/net/datafaker/providers/base/MeasurementTest.java
+++ b/src/test/java/net/datafaker/providers/base/MeasurementTest.java
@@ -1,6 +1,12 @@
package net.datafaker.providers.base;
import java.util.List;
+import java.util.Locale;
+
+import org.junit.jupiter.api.AfterAll;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Nested;
+
import java.util.Collection;
class MeasurementTest extends BaseFakerTest<BaseFaker> {
@@ -19,4 +25,32 @@ protected Collection<TestSpec> providerListTest() {
TestSpec.of(measurement::metricVolume, "measurement.metric_volume"),
TestSpec.of(measurement::metricWeight, "measurement.metric_weight"));
}
+
+ @Nested
+ class GreekMeasurementTest extends BaseFakerTest<BaseFaker> {
+
+ @BeforeAll
+ void setup() {
+ this.setFaker(new BaseFaker(new Locale("el", "GR")));
+ }
+
+ @AfterAll
+ void reset() {
+ this.setFaker(this.getFaker());
+ }
+
+ @Override
+ protected Collection<TestSpec> providerListTest() {
+
+ Measurement measurement = faker.measurement();
+ return List.of(TestSpec.of(measurement::height, "measurement.height"),
+ TestSpec.of(measurement::length, "measurement.length"),
+ TestSpec.of(measurement::volume, "measurement.volume"),
+ TestSpec.of(measurement::weight, "measurement.weight"),
+ TestSpec.of(measurement::metricLength, "measurement.metric_length"),
+ TestSpec.of(measurement::metricHeight, "measurement.metric_height"),
+ TestSpec.of(measurement::metricVolume, "measurement.metric_volume"),
+ TestSpec.of(measurement::metricWeight, "measurement.metric_weight"));
+ }
+ }
}Maybe also go back and add tests for your other addition too "wink: |
|
@kingthorin thank you very much for the boost with the tests. 👍 |
Some more translations, for Measurement provider this time.
Could you please annotate this PR with hacktoberfest-accepted label?