Skip to content

Commit

Permalink
. t Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
ScottBob committed Jan 25, 2024
1 parent 81abe05 commit 89eb21d
Showing 1 changed file with 3 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import com.spun.util.StringUtils;
import org.approvaltests.core.Options;
import org.junit.jupiter.api.Test;
import org.lambda.functions.Function1;
import org.lambda.query.Query;
import org.lambda.query.Queryable;

Expand Down Expand Up @@ -41,19 +40,14 @@ public static String showParameters(Method m) {
public static String showParametersWithGrayedOutOptions(Method m)
{
Queryable<Parameter> withoutOptions = Queryable.as(m.getParameters());
return StringUtils.join(withoutOptions.select(p1 -> formatTypesWithGrayedOutOptions(p1)), ", ");
return StringUtils.join(withoutOptions.select(DocumentHelpersTest::formatTypesWithGrayedOutOptions), ", ");
}

private static String formatTypesWithGrayedOutOptions(Parameter p1) {
String simpleName = p1.getType().getSimpleName();
return simpleName.equals("Options") ? "$\\color{#AAA}{\\textsf{Options}}$" : simpleName;
}

private static String showParametersExcept(Method m, Function1<Parameter, Boolean> filter) {
Queryable<Parameter> withoutOptions = Query.where(m.getParameters(), filter);
return StringUtils.join(withoutOptions.select(p -> String.format("%s", p.getType().getSimpleName())), ",");
}

public static String getLink(Method m)
{
String baseUrl = "https://github.com/approvals/ApprovalTests.Java/blob/master/approvaltests/src/main/java";
Expand All @@ -67,12 +61,12 @@ public static String getLink(Method m)
private Queryable<Method> getAllVerifyFunctionsWithOptions(List<Class<?>> approvalClasses)
{
Queryable<Method> methods = new Queryable<>(Method.class);
for (Class c : approvalClasses)
for (Class<?> c : approvalClasses)
{
Queryable<Method> declaredMethods = Queryable.as(c.getDeclaredMethods());
Queryable<Method> methodList = declaredMethods.where(m -> m.getName().startsWith("verify")
&& Modifier.isPublic(m.getModifiers()) && !m.isAnnotationPresent(Deprecated.class));
List<Method> methodsWithOptions = methodList.where(m -> OptionsTest.isOptionsPresent(m));
List<Method> methodsWithOptions = methodList.where(OptionsTest::isOptionsPresent);
methods.addAll(methodsWithOptions);
}
return methods;
Expand Down

0 comments on commit 89eb21d

Please sign in to comment.