| 9 | import static org.apache.commons.lang3.StringUtils.join; |
| 10 | |
| 11 | public class Company { |
| 12 | |
| 13 | private final Faker faker; |
| 14 | |
| 15 | protected Company(Faker faker) { |
| 16 | this.faker = faker; |
| 17 | } |
| 18 | |
| 19 | public String name() { |
| 20 | return faker.fakeValuesService().resolve("company.name", this, faker); |
| 21 | } |
| 22 | |
| 23 | public String suffix() { |
| 24 | return faker.fakeValuesService().resolve("company.suffix", this, faker); |
| 25 | } |
| 26 | |
| 27 | public String industry() { |
| 28 | return faker.fakeValuesService().resolve("company.industry", this, faker); |
| 29 | } |
| 30 | |
| 31 | public String profession() { |
| 32 | return faker.fakeValuesService().resolve("company.profession", this, faker); |
| 33 | } |
| 34 | |
| 35 | public String buzzword() { |
| 36 | @SuppressWarnings("unchecked") |
| 37 | List<List<String>> buzzwordLists = (List<List<String>>) faker.fakeValuesService().fetchObject("company.buzzwords"); |
| 38 | List<String> buzzwords = new ArrayList<String>(); |
| 39 | for (List<String> buzzwordList : buzzwordLists) { |
| 40 | buzzwords.addAll(buzzwordList); |
| 41 | } |
| 42 | return buzzwords.get(faker.random().nextInt(buzzwords.size())); |
| 43 | } |
| 44 | |
| 45 | /** |
| 46 | * Generate a buzzword-laden catch phrase. |
| 47 | */ |
| 48 | public String catchPhrase() { |
| 49 | @SuppressWarnings("unchecked") |
| 50 | List<List<String>> catchPhraseLists = (List<List<String>>) faker.fakeValuesService().fetchObject("company.buzzwords"); |
| 51 | return joinSampleOfEachList(catchPhraseLists, " "); |
| 52 | } |
| 53 | |
| 54 | /** |
| 55 | * When a straight answer won't do, BS to the rescue! |
| 56 | */ |
| 57 | public String bs() { |
| 58 | @SuppressWarnings("unchecked") |
| 59 | List<List<String>> buzzwordLists = (List<List<String>>) faker.fakeValuesService().fetchObject("company.bs"); |
| 60 | return joinSampleOfEachList(buzzwordLists, " "); |
| 61 | } |
| 62 | |
| 63 | /** |
| 64 | * Generate a random company logo url in PNG format. |
| 65 | */ |
| 66 | public String logo() { |
| 67 | int number = faker.random().nextInt(13) + 1; |
| 68 | return "https://pigment.github.io/fake-logos/logos/medium/color/" + number + ".png"; |
nothing calls this directly
no outgoing calls
no test coverage detected