-
Notifications
You must be signed in to change notification settings - Fork 176
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #165 from Tahanima/feature/add-house-faker
Added House Faker
- Loading branch information
Showing
7 changed files
with
53 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
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,28 @@ | ||
package net.datafaker; | ||
|
||
public class House { | ||
|
||
private final Faker faker; | ||
|
||
protected House(Faker faker) { | ||
this.faker = faker; | ||
} | ||
|
||
/** | ||
* This method generates a random name of furniture. | ||
* | ||
* @return a string of furniture. | ||
*/ | ||
public String furniture() { | ||
return faker.fakeValuesService().resolve("house.furniture", this, faker); | ||
} | ||
|
||
/** | ||
* This method generates a random name of a room in a house. | ||
* | ||
* @return a string of room. | ||
*/ | ||
public String room() { | ||
return faker.fakeValuesService().resolve("house.rooms", this, faker); | ||
} | ||
} |
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
File renamed without changes.
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,18 @@ | ||
package net.datafaker; | ||
|
||
import org.junit.jupiter.api.Test; | ||
|
||
import static org.assertj.core.api.Assertions.assertThat; | ||
|
||
class HouseTest extends AbstractFakerTest { | ||
|
||
@Test | ||
void testFurniture() { | ||
assertThat(faker.house().furniture()).matches("^[a-zA-Z ]+$"); | ||
} | ||
|
||
@Test | ||
void testRoom() { | ||
assertThat(faker.house().room()).matches("^[a-zA-Z ]+$"); | ||
} | ||
} |
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