Skip to content

Commit c7ab5e0

Browse files
committed
Add DcComics Faker
1 parent e49bec7 commit c7ab5e0

File tree

7 files changed

+70
-1
lines changed

7 files changed

+70
-1
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,7 @@ Providers
194194
* Currency
195195
* DateAndTime
196196
* Demographic
197+
* DcComics
197198
* Dessert
198199
* Device
199200
* Disease
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
package net.datafaker;
2+
3+
public class DcComics {
4+
5+
private final Faker faker;
6+
7+
public DcComics(Faker faker) {
8+
this.faker = faker;
9+
}
10+
11+
public String hero() {
12+
return faker.resolve("dc_comics.hero");
13+
}
14+
15+
public String heroine() {
16+
return faker.resolve("dc_comics.heroine");
17+
}
18+
19+
public String villain() {
20+
return faker.resolve("dc_comics.villain");
21+
}
22+
23+
public String name() {
24+
return faker.resolve("dc_comics.name");
25+
}
26+
27+
public String title() {
28+
return faker.resolve("dc_comics.title");
29+
}
30+
}

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -470,6 +470,10 @@ public Disease disease() {
470470
return getProvider(Disease.class, () -> new Disease(this));
471471
}
472472

473+
public DcComics dcComics() {
474+
return getProvider(DcComics.class, () -> new DcComics(this));
475+
}
476+
473477
public Demographic demographic() {
474478
return getProvider(Demographic.class, () -> new Demographic(this));
475479
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ public String getPath() {
7272
"crypto_coin.yml",
7373
// "culture_series.yml",
7474
"currency.yml",
75-
// "dc_comics.yml",
75+
"dc_comics.yml",
7676
"dark_soul.yml",
7777
"demographic.yml",
7878
"dessert.yml",
File renamed without changes.
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
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 DcComicsTest extends AbstractFakerTest {
8+
9+
@Test
10+
void hero() {
11+
assertThat(faker.dcComics().hero()).isNotEmpty();
12+
}
13+
14+
@Test
15+
void heroine() {
16+
assertThat(faker.dcComics().heroine()).isNotEmpty();
17+
}
18+
19+
@Test
20+
void villain() {
21+
assertThat(faker.dcComics().villain()).isNotEmpty();
22+
}
23+
24+
@Test
25+
void name() {
26+
assertThat(faker.dcComics().name()).isNotEmpty();
27+
}
28+
29+
@Test
30+
void title() {
31+
assertThat(faker.dcComics().title()).isNotEmpty();
32+
}
33+
}

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ void testAllFakerMethodsThatReturnStrings(Locale locale, Random random) throws E
110110
testAllMethodsThatReturnStringsActuallyReturnStrings(faker.demographic());
111111
testAllMethodsThatReturnStringsActuallyReturnStrings(faker.dessert());
112112
testAllMethodsThatReturnStringsActuallyReturnStrings(faker.device());
113+
testAllMethodsThatReturnStringsActuallyReturnStrings(faker.dcComics());
113114
testAllMethodsThatReturnStringsActuallyReturnStrings(faker.disease());
114115
testAllMethodsThatReturnStringsActuallyReturnStrings(faker.dog());
115116
testAllMethodsThatReturnStringsActuallyReturnStrings(faker.dragonBall());

0 commit comments

Comments
 (0)