-
Notifications
You must be signed in to change notification settings - Fork 0
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
1 parent
dc1e8dc
commit 1a0048c
Showing
7 changed files
with
51 additions
and
145 deletions.
There are no files selected for viewing
16 changes: 8 additions & 8 deletions
16
...m/example/allin/data/ContractFactory.java → ...om/appdev/allin/data/ContractFactory.java
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
8 changes: 4 additions & 4 deletions
8
...example/allin/data/PlayerDataFactory.java → .../appdev/allin/data/PlayerDataFactory.java
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 |
---|---|---|
@@ -1,34 +1,41 @@ | ||
package com.appdev.allin.data; | ||
|
||
import com.appdev.allin.player.Player; | ||
import com.appdev.allin.player.Position; | ||
import com.github.javafaker.Faker; | ||
import java.util.Random; | ||
|
||
|
||
public class PlayerFactory { | ||
private static final Faker faker = new Faker(); | ||
private static final Random random = new Random(); | ||
|
||
public static Player fakeTemplate() { | ||
return new Player( | ||
"LeBron", | ||
"James", | ||
new Position[] {Position.Center}, | ||
23, | ||
"6'9", | ||
250, | ||
"Akron, OH", | ||
"St. Vincent-St. Mary", | ||
"src/main/resources/static/images/players/default.jpg"); | ||
} | ||
|
||
public static Player fake() { | ||
// return a player with random values | ||
return new Player( | ||
"LeBron", | ||
"James", | ||
new Position[] {Position.Center}, | ||
23, | ||
"6'9", | ||
250, | ||
"Akron, OH", | ||
"St. Vincent-St. Mary", | ||
"src/main/resources/static/images/players/default.jpg"); | ||
public static Player createFakePlayer() { | ||
String firstName = faker.name().firstName(); | ||
String lastName = faker.name().lastName(); | ||
Position[] positions = generateRandomPositions(); | ||
Integer number = faker.number().numberBetween(1, 99); // Jersey numbers typically range from 1-99 | ||
String height = generateRandomHeight(); | ||
Integer weight = faker.number().numberBetween(150, 250); // Weight in pounds, adjustable as needed | ||
String hometown = faker.address().city() + ", " + faker.address().state(); | ||
String highSchool = faker.educator().secondarySchool(); | ||
return new Player(firstName, lastName, positions, number, height, weight, hometown, highSchool); | ||
} | ||
|
||
private static Position[] generateRandomPositions() { | ||
Position[] allPositions = Position.values(); | ||
int count = random.nextInt(2) + 1; // Players can have 1 or 2 positions | ||
Position[] positions = new Position[count]; | ||
for (int i = 0; i < count; i++) { | ||
positions[i] = allPositions[random.nextInt(allPositions.length)]; | ||
} | ||
return positions; | ||
} | ||
|
||
private static String generateRandomHeight() { | ||
int feet = faker.number().numberBetween(5, 7); // Heights between 5 and 7 feet | ||
int inches = faker.number().numberBetween(0, 11); | ||
return feet + "'" + inches + "\""; | ||
} | ||
|
||
} |
10 changes: 5 additions & 5 deletions
10
...xample/allin/data/TransactionFactory.java → ...appdev/allin/data/TransactionFactory.java
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
4 changes: 2 additions & 2 deletions
4
...a/com/example/allin/data/UserFactory.java → ...va/com/appdev/allin/data/UserFactory.java
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
60 changes: 0 additions & 60 deletions
60
src/test/java/com/example/allin/AllInApplicationTests.java
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.