Repository navigation
Expand file tree
/
Copy pathUkLocalDirectivesTest.java
More file actions
54 lines (41 loc) · 1.86 KB
/
Copy pathUkLocalDirectivesTest.java
File metadata and controls
54 lines (41 loc) · 1.86 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
package com.github.javafaker.integration;
import com.github.javafaker.Faker;
import com.google.common.collect.Lists;
import org.junit.Ignore;
import org.junit.Test;
import java.util.ArrayList;
import java.util.Locale;
import static org.hamcrest.Matchers.is;
import static org.junit.Assert.assertThat;
/**
* The purpose of these tests is to ensure that the Locales have been properly configured
* and that methods return values. The unit tests should ensure what the values returned
* are correct. These tests just ensure that the methods can be invoked.
*/
@Ignore
public class UkLocalDirectivesTest {
/**
* uk is interesting in that it has feminine and masculine prefixes for street names. the feminine
* and masculine prefixes are NOT methods on Address though as they only make sense for this locale (and possibly
* others). This test shows we can resolve within the yml file without reaching out to any of the {@link Faker}
* child objects.
*/
@Test
public void resolvesDirectivesOnlyInYmlFile() {
final Locale uk = new Locale("uk");
final String streetName = new Faker(uk).address().streetName();
final ArrayList<String> masc = Lists.newArrayList("пр.", "проспект", "пров.", "провулок");
final ArrayList<String> fem = Lists.newArrayList("вул.", "вулиця", "пл.", "площа");
boolean startsWithMascPrefix = false,
startsWithFemPrefix = false;
for (String mascPrefix : masc) {
startsWithMascPrefix |= streetName.startsWith(mascPrefix);
}
for (String femPrefix : fem) {
startsWithFemPrefix |= streetName.startsWith(femPrefix);
}
assertThat("the streetname starts with a fem or masc prefix",
startsWithFemPrefix || startsWithMascPrefix,
is(true));
}
}