Skip to content

Commit

Permalink
update EzyUnitTestCreator
Browse files Browse the repository at this point in the history
  • Loading branch information
tvd12 committed Jun 5, 2023
1 parent cc8a37e commit 16f2d00
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,9 @@ public String createToFile(Method method) {
public String create(String method) {
List<Method> methods = EzyMethods.getMethods(clazz);
for (Method m : methods) {
return create(m);
if (m.getName().equals(method)) {
return create(m);
}
}
throw new IllegalArgumentException("not found method: " + method);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package com.tvd12.ezyfox.testing.tool;

import com.tvd12.ezyfox.tool.EzyBuilderCreator;
import com.tvd12.ezyfox.tool.EzyUnitTestCreator;
import org.testng.annotations.Test;

public class EzyUnitTestCreatorTest {

Expand All @@ -15,4 +17,18 @@ public void test() {
tool.setTestPackage("com.tvd12.ezyfox.testing.tool");
System.out.println(tool.createToFile("func1"));
}

@Test
public void createTest() {
// given
EzyUnitTestCreator instance = new EzyUnitTestCreator(
EzyBuilderCreator.class
);

// when
String actual = instance.create("buildBySetter");

// then
System.out.println(actual);
}
}

0 comments on commit 16f2d00

Please sign in to comment.