Skip to content

Commit e9333b0

Browse files
committed
Add 'Industry Segments' faker
1 parent ff42c76 commit e9333b0

File tree

7 files changed

+62
-1
lines changed

7 files changed

+62
-1
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,7 @@ Providers
230230
* House
231231
* HowIMetYourMother
232232
* IdNumber
233+
* Industry Segments
233234
* Internet
234235
* Job
235236
* Kaamelott

src/main/java/net/datafaker/Faker.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -672,6 +672,10 @@ public IdNumber idNumber() {
672672
return getProvider(IdNumber.class, () -> new IdNumber(this));
673673
}
674674

675+
public IndustrySegments industrySegments() {
676+
return getProvider(IndustrySegments.class, () -> new IndustrySegments(this));
677+
}
678+
675679
public Internet internet() {
676680
return getProvider(Internet.class, () -> new Internet(this));
677681
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
package net.datafaker;
2+
3+
public class IndustrySegments {
4+
5+
private final Faker faker;
6+
7+
protected IndustrySegments(Faker faker) {
8+
this.faker = faker;
9+
}
10+
11+
public String industry() {
12+
return faker.resolve("industry_segments.industry");
13+
}
14+
15+
public String superSector() {
16+
return faker.resolve("industry_segments.super_sector");
17+
}
18+
19+
public String sector() {
20+
return faker.resolve("industry_segments.sector");
21+
}
22+
23+
public String subSector() {
24+
return faker.resolve("industry_segments.sub_sector");
25+
}
26+
27+
}

src/main/java/net/datafaker/service/files/EnFile.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ public String getPath() {
124124
"house.yml",
125125
"how_i_met_your_mother.yml",
126126
"id_number.yml",
127-
// "industry_segments.yml",
127+
"industry_segments.yml",
128128
"internet.yml",
129129
// "invoice.yml",
130130
"job.yml",
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
package net.datafaker;
2+
3+
import org.junit.jupiter.api.Test;
4+
5+
import static org.assertj.core.api.Assertions.assertThat;
6+
7+
public class IndustrySegmentsTest extends AbstractFakerTest {
8+
9+
@Test
10+
void testIndustry() {
11+
assertThat(faker.industrySegments().industry()).isNotEmpty();
12+
}
13+
14+
@Test
15+
void testSuperSector() {
16+
assertThat(faker.industrySegments().superSector()).isNotEmpty();
17+
}
18+
19+
@Test
20+
void testSector() {
21+
assertThat(faker.industrySegments().sector()).isNotEmpty();
22+
}
23+
24+
@Test
25+
void testSubSector() {
26+
assertThat(faker.industrySegments().subSector()).isNotEmpty();
27+
}
28+
}

src/test/java/net/datafaker/integration/FakerIT.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,7 @@ void testAllFakerMethodsThatReturnStrings(Locale locale, Random random) throws E
147147
testAllMethodsThatReturnStringsActuallyReturnStrings(faker.house());
148148
testAllMethodsThatReturnStringsActuallyReturnStrings(faker.howIMetYourMother());
149149
testAllMethodsThatReturnStringsActuallyReturnStrings(faker.idNumber());
150+
testAllMethodsThatReturnStringsActuallyReturnStrings(faker.industrySegments());
150151
testAllMethodsThatReturnStringsActuallyReturnStrings(faker.internet());
151152
testAllMethodsThatReturnStringsActuallyReturnStrings(faker.job());
152153
testAllMethodsThatReturnStringsActuallyReturnStrings(faker.kaamelott());

0 commit comments

Comments
 (0)