Skip to content

Commit

Permalink
\apache#3116: Fake Data throws NoSuchMethodException for some types
Browse files Browse the repository at this point in the history
  • Loading branch information
Matt Tucker authored and vboxuser committed Jul 28, 2023
1 parent b5e6dbb commit 43e9e06
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,12 @@ public enum FakerType {
Book(com.github.javafaker.Book.class, "book", "Book"),
Business(com.github.javafaker.Business.class, "business", "Business"),
ChuckNorris(com.github.javafaker.ChuckNorris.class, "chuckNorris", "Chuck Norris"),
Color(com.github.javafaker.Color.class, "Color", "Color"),
Color(com.github.javafaker.Color.class, "color", "Color"),
IdNumber(com.github.javafaker.IdNumber.class, "idNumber", "Id/Number"),
Hacker(com.github.javafaker.Hacker.class, "hacker", "Hacker"),
Company(com.github.javafaker.Company.class, "company", "Company"),
Crypto(com.github.javafaker.Crypto.class, "crypto", "Crypto"),
Elder(com.github.javafaker.ElderScrolls.class, "elder", "Elder"),
Elder(com.github.javafaker.ElderScrolls.class, "elderScrolls", "Elder"),
Commerce(com.github.javafaker.Commerce.class, "commerce", "Commerce"),
Currency(com.github.javafaker.Currency.class, "currency", "Currency"),
Options(com.github.javafaker.Options.class, "options", "Options"),
Expand All @@ -47,7 +47,7 @@ public enum FakerType {
Finance(com.github.javafaker.Finance.class, "finance", "Finance"),
Food(com.github.javafaker.Food.class, "food", "Food"),
GameOfThrones(com.github.javafaker.GameOfThrones.class, "gameOfThrones", "Game of Thrones"),
DateAndTime(com.github.javafaker.DateAndTime.class, "dateAndTime", "Date and Time"),
DateAndTime(com.github.javafaker.DateAndTime.class, "date", "Date and Time"),
Demographic(com.github.javafaker.Demographic.class, "demographic", "Demographic"),
Dog(com.github.javafaker.Dog.class, "dog", "Dog"),
Educator(com.github.javafaker.Educator.class, "educator", "Educator"),
Expand Down Expand Up @@ -97,7 +97,7 @@ public enum FakerType {
com.github.javafaker.BackToTheFuture.class, "backToTheFuture", "Back to the future"),
PrincessBride(com.github.javafaker.PrincessBride.class, "princessBride", "Princess bride"),
Buffy(com.github.javafaker.Buffy.class, "buffy", "Buffy"),
Relationships(com.github.javafaker.Relationships.class, "relationshops", "Relationships"),
Relationships(com.github.javafaker.Relationships.class, "relationships", "Relationships"),
Nation(com.github.javafaker.Nation.class, "nation", "Nation"),
Dune(com.github.javafaker.Dune.class, "dune", "Dune"),
AquaTeenHungerForce(
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package org.apache.hop.pipeline.transforms.fake;

import com.github.javafaker.Faker;
import org.junit.Assert;
import org.junit.Test;

public class FakerTypeTest {

@Test
public void testFakerTypeMethodMapping() throws Exception {
Faker faker = new Faker();
for(FakerType type : FakerType.values() ) {
try {
faker.getClass().getMethod(type.getFakerMethod());
} catch (NoSuchMethodException | SecurityException e) {
Assert.fail(String.format("%s method was not found in Faker", type.getFakerMethod()));
}
}
}
}

0 comments on commit 43e9e06

Please sign in to comment.