From 46bf879d0b8870713a4691050ff8fce29a08372d Mon Sep 17 00:00:00 2001 From: GitHub Action Date: Mon, 12 Feb 2024 20:58:21 +0000 Subject: [PATCH] a reformat code --- .../test/java/org/approvaltests/ParseInput.java | 15 ++++++--------- .../java/org/approvaltests/ParseInputTest.java | 4 ++-- 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/approvaltests-tests/src/test/java/org/approvaltests/ParseInput.java b/approvaltests-tests/src/test/java/org/approvaltests/ParseInput.java index 69c07a94..5a6e7633 100644 --- a/approvaltests-tests/src/test/java/org/approvaltests/ParseInput.java +++ b/approvaltests-tests/src/test/java/org/approvaltests/ParseInput.java @@ -33,12 +33,11 @@ public static ParseInput createFromParts(String expected, Function1(s, transformer.call(temp)); }); } - - public static ParseInput createFromParts(String expected, Function2 transformer, Class in1, Class in2) + public static ParseInput createFromParts(String expected, Function2 transformer, + Class in1, Class in2) { - Function1 t1 = getTransformerForClass(in1); - Function1 t2 = getTransformerForClass(in2); - + Function1 t1 = getTransformerForClass(in1); + Function1 t2 = getTransformerForClass(in2); return new ParseInput(expected, s -> { var temp = Queryable.as(s.split(",")).select(String::trim); IN1 v1 = t1.call(temp.get(0)); @@ -47,14 +46,13 @@ public static ParseInput createFromParts(String expected, Funct return new Tuple<>(s, out); }); } - public static ParseInput create(String expected, Class tranformTo) { Function1 transformer1 = getTransformerForClass(tranformTo); return ParseInput.create(expected, transformer1); } - - private static Function1 getTransformerForClass(Class tranformTo) { + private static Function1 getTransformerForClass(Class tranformTo) + { var transformers = new HashMap, Function1>() { { @@ -70,7 +68,6 @@ private static Function1 getTransformerForClass(Class tranform Function1 transformer1 = (Function1) transformers.get(tranformTo); return transformer1; } - public Queryable> parse(String expected) { return Queryable.as(expected.lines()).select(l -> l.split("->")[0].trim()).select(l -> transformer.call(l)); diff --git a/approvaltests-tests/src/test/java/org/approvaltests/ParseInputTest.java b/approvaltests-tests/src/test/java/org/approvaltests/ParseInputTest.java index 0ab185f4..980a1bae 100644 --- a/approvaltests-tests/src/test/java/org/approvaltests/ParseInputTest.java +++ b/approvaltests-tests/src/test/java/org/approvaltests/ParseInputTest.java @@ -62,7 +62,7 @@ void testPeopleEasyLoad() Llewellyn, 25 -> adult Oliver, 15 -> teenager """; - ParseInput.createFromParts(expected, (n,a) -> new Person(n,a), String.class, Integer.class) - .verifyAll(s -> s.getAgeLabel()); + ParseInput.createFromParts(expected, (n, a) -> new Person(n, a), String.class, Integer.class) + .verifyAll(s -> s.getAgeLabel()); } } \ No newline at end of file