This is an automated email from the ASF dual-hosted git repository.

hansva pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/hop.git


The following commit(s) were added to refs/heads/master by this push:
     new 43e9e06317 \#3116: Fake Data throws NoSuchMethodException for some 
types
     new acd2f98a2d Merge pull request #3117 from matthewtckr/issue-3116
43e9e06317 is described below

commit 43e9e06317f4d6b0ee3c41e81ac437e4c31318e3
Author: Matt Tucker <[email protected]>
AuthorDate: Thu Jul 27 17:40:35 2023 -0400

    \#3116: Fake Data throws NoSuchMethodException for some types
---
 .../hop/pipeline/transforms/fake/FakerType.java    |  8 ++---
 .../pipeline/transforms/fake/FakerTypeTest.java    | 37 ++++++++++++++++++++++
 2 files changed, 41 insertions(+), 4 deletions(-)

diff --git 
a/plugins/transforms/fake/src/main/java/org/apache/hop/pipeline/transforms/fake/FakerType.java
 
b/plugins/transforms/fake/src/main/java/org/apache/hop/pipeline/transforms/fake/FakerType.java
index 16132740f8..1d1ab0d805 100644
--- 
a/plugins/transforms/fake/src/main/java/org/apache/hop/pipeline/transforms/fake/FakerType.java
+++ 
b/plugins/transforms/fake/src/main/java/org/apache/hop/pipeline/transforms/fake/FakerType.java
@@ -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"),
@@ -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"),
@@ -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(
diff --git 
a/plugins/transforms/fake/src/test/java/org/apache/hop/pipeline/transforms/fake/FakerTypeTest.java
 
b/plugins/transforms/fake/src/test/java/org/apache/hop/pipeline/transforms/fake/FakerTypeTest.java
new file mode 100644
index 0000000000..bbf9d8b9b2
--- /dev/null
+++ 
b/plugins/transforms/fake/src/test/java/org/apache/hop/pipeline/transforms/fake/FakerTypeTest.java
@@ -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()));
+      }
+    }
+  }
+}

Reply via email to