Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
76 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -102,6 +102,7 @@ Fakers | |
* LordOfTheRings | ||
* Lorem | ||
* Matz | ||
* Military | ||
* Music | ||
* Name | ||
* Nation | ||
|
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,31 @@ | ||
package com.github.javafaker; | ||
|
||
public class Military { | ||
|
||
private final Faker faker; | ||
|
||
protected Military(Faker faker) { | ||
this.faker = faker; | ||
} | ||
|
||
public String armyRank() { | ||
return faker.fakeValuesService().fetchString("military.army_rank"); | ||
} | ||
|
||
public String marinesRank() { | ||
return faker.fakeValuesService().fetchString("military.marines_rank"); | ||
} | ||
|
||
public String navyRank() { | ||
return faker.fakeValuesService().fetchString("military.navy_rank"); | ||
} | ||
|
||
public String airForceRank() { | ||
return faker.fakeValuesService().fetchString("military.air_force_rank"); | ||
} | ||
|
||
public String dodPaygrade() { | ||
return faker.fakeValuesService().fetchString("military.dod_paygrade"); | ||
} | ||
|
||
} |
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,36 @@ | ||
package com.github.javafaker; | ||
|
||
import com.github.javafaker.repeating.Repeat; | ||
import org.junit.Test; | ||
|
||
import static com.github.javafaker.matchers.MatchesRegularExpression.matchesRegularExpression; | ||
import static org.junit.Assert.assertThat; | ||
|
||
public class MilitaryTest extends AbstractFakerTest { | ||
|
||
@Test | ||
public void armyRank() { | ||
assertThat(faker.military().armyRank(), matchesRegularExpression("[A-Za-z ]+")); | ||
} | ||
|
||
@Test | ||
public void marinesRank() { | ||
assertThat(faker.military().marinesRank(), matchesRegularExpression("[A-Za-z ]+")); | ||
} | ||
|
||
@Test | ||
public void navyRank() { | ||
assertThat(faker.military().navyRank(), matchesRegularExpression("[A-Za-z ]+")); | ||
} | ||
|
||
@Test | ||
public void airForceRank() { | ||
assertThat(faker.military().airForceRank(), matchesRegularExpression("[A-Za-z ]+")); | ||
} | ||
|
||
@Test | ||
public void dodPaygrade() { | ||
assertThat(faker.military().dodPaygrade(), matchesRegularExpression("((E|O)\\-([0-9]|10)$)|Special")); | ||
} | ||
|
||
} |
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