From 0a9bb4a9a390df73773e9b9d899748950ddbf2af Mon Sep 17 00:00:00 2001 From: github actions Date: Tue, 26 Mar 2024 20:26:25 +0000 Subject: [PATCH] . d updated markdown snippets --- approvaltests-util/docs/ArrayUtils.md | 8 ++++---- .../docs/how_to/VarArgsWithAtleastOne.md | 12 ++++++------ approvaltests/docs/Scrubbers.md | 4 ++-- approvaltests/docs/how_to/MachineNameSpecificTest.md | 4 ++-- approvaltests/docs/how_to/ShowNullsInJson.md | 4 ++-- approvaltests/docs/how_to/TestAVarietyOfValues.md | 4 ++-- approvaltests/docs/how_to/TestCombinations.md | 8 ++++---- approvaltests/docs/reference/AwtApprovals.md | 4 ++-- approvaltests/docs/reference/IntelliJReporter.md | 4 ++-- approvaltests/docs/reference/StoryBoard.md | 4 ++-- 10 files changed, 28 insertions(+), 28 deletions(-) diff --git a/approvaltests-util/docs/ArrayUtils.md b/approvaltests-util/docs/ArrayUtils.md index c48037e43..bea7bf532 100644 --- a/approvaltests-util/docs/ArrayUtils.md +++ b/approvaltests-util/docs/ArrayUtils.md @@ -12,7 +12,7 @@ ArrayUtils has the ability to dynamically determine the type of your list. - + ```java List comparables = new ArrayList<>(); comparables.add(null); @@ -21,18 +21,18 @@ comparables.add(3.1415); comparables.add("Lars"); Comparable[] comparableArray = ArrayUtils.toArray(comparables); ``` -snippet source | anchor +snippet source | anchor This works in almost all cases with the notable exceptions of empty arrays, some common interfaces which will not be preferenced. In which case you can always use the overloaded method - + ```java Comparable[] array = ArrayUtils.toArray(comparables, Comparable.class); ``` -snippet source | anchor +snippet source | anchor diff --git a/approvaltests-util/docs/how_to/VarArgsWithAtleastOne.md b/approvaltests-util/docs/how_to/VarArgsWithAtleastOne.md index 703ad66f6..6d27550a7 100644 --- a/approvaltests-util/docs/how_to/VarArgsWithAtleastOne.md +++ b/approvaltests-util/docs/how_to/VarArgsWithAtleastOne.md @@ -19,7 +19,7 @@ Most solutions for this occur at runtime. Of course, it would be better if they ### Runtime solution - + ```java public Integer findSmallest(Integer... numbers) { @@ -27,7 +27,7 @@ public Integer findSmallest(Integer... numbers) { throw new IllegalArgumentException("you must have at least one number"); } // rest of the code ``` -snippet source | anchor +snippet source | anchor ### Compile time solution @@ -37,14 +37,14 @@ If you do this, you will want to recombine this array almost immediately `ArrayU Please be aware that it will not work with primitives. - + ```java public Integer findSmallest(Integer first, Integer... numbers) { Integer[] combined = ArrayUtils.combine(first, numbers); // rest of the code ``` -snippet source | anchor +snippet source | anchor ### Advantages @@ -53,11 +53,11 @@ If you use the runtime solution, the following will compile but throw an error w If you use the compile time solution, it will not compile. - + ```java int smallest = findSmallest(); ``` -snippet source | anchor +snippet source | anchor ### Where to use this diff --git a/approvaltests/docs/Scrubbers.md b/approvaltests/docs/Scrubbers.md index 5da73281c..3167403ef 100644 --- a/approvaltests/docs/Scrubbers.md +++ b/approvaltests/docs/Scrubbers.md @@ -147,7 +147,7 @@ created at [Date1] If you need to do scrubbing of multiple things, the easiest way is to create multiple scrubbers and then combine them. - + ```java final Scrubber portScrubber = new RegExScrubber(":\\d+/", ":[port]/"); final Scrubber dateScrubber = DateScrubber.getScrubberFor("20210505T091112Z"); @@ -156,7 +156,7 @@ Scrubber scrubber = Scrubbers.scrubAll(portScrubber, dateScrubber, signatureScru Approvals.verify("http://127.0.0.1:55079/foo/bar?Date=20210505T091112Z&Signature=4a7dd6f09c1e", new Options(scrubber)); ``` -snippet source | anchor +snippet source | anchor will result in diff --git a/approvaltests/docs/how_to/MachineNameSpecificTest.md b/approvaltests/docs/how_to/MachineNameSpecificTest.md index a38a40f2e..52ef3f649 100644 --- a/approvaltests/docs/how_to/MachineNameSpecificTest.md +++ b/approvaltests/docs/how_to/MachineNameSpecificTest.md @@ -22,7 +22,7 @@ It checks if the current machine's name matches the specified name (e.g., ".lars The actual test code should be placed after this condition. - + ```java try (NamedEnvironment namedEnvironment = NamerFactory.asMachineNameSpecificTest()) { @@ -30,7 +30,7 @@ try (NamedEnvironment namedEnvironment = NamerFactory.asMachineNameSpecificTest( { return; } // the rest of your test... ``` -snippet source | anchor +snippet source | anchor **please note:** this will also append the machine name to the ApprovalTest so that each specific diff --git a/approvaltests/docs/how_to/ShowNullsInJson.md b/approvaltests/docs/how_to/ShowNullsInJson.md index 1ef1a8bf0..ca4f75111 100644 --- a/approvaltests/docs/how_to/ShowNullsInJson.md +++ b/approvaltests/docs/how_to/ShowNullsInJson.md @@ -9,10 +9,10 @@ To modify this behavior and display null fields, follow the example provided below. - + ```java Person person = new Person("Max", null, 1); JsonApprovals.verifyAsJson(person, GsonBuilder::serializeNulls); ``` -snippet source | anchor +snippet source | anchor diff --git a/approvaltests/docs/how_to/TestAVarietyOfValues.md b/approvaltests/docs/how_to/TestAVarietyOfValues.md index 079d640ec..4c17e2568 100644 --- a/approvaltests/docs/how_to/TestAVarietyOfValues.md +++ b/approvaltests/docs/how_to/TestAVarietyOfValues.md @@ -20,12 +20,12 @@ If you have more than one parameter that you want to vary, check out [Testing Co 1. Copy this starter text. - + ```java String[] inputs = {"input.value1", "input.value2"}; Approvals.verifyAll("TITLE", inputs, s -> "placeholder " + s); ``` -snippet source | anchor +snippet source | anchor 2. Modify the input container for your chosen values. diff --git a/approvaltests/docs/how_to/TestCombinations.md b/approvaltests/docs/how_to/TestCombinations.md index 5c50d69b2..a183b334a 100644 --- a/approvaltests/docs/how_to/TestCombinations.md +++ b/approvaltests/docs/how_to/TestCombinations.md @@ -20,13 +20,13 @@ If you have only one parameter that you want to vary, check out [How to Test a V 1. Copy this starter text, and adjust for the number of inputs that you have. - + ```java String[] inputs1 = {"input1.value1", "input1.value2"}; String[] inputs2 = {"input2.value1", "input2.value2", "input2.value3"}; CombinationApprovals.verifyAllCombinations((a, b) -> "placeholder", inputs1, inputs2); ``` -snippet source | anchor +snippet source | anchor 2. Modify each input container for your chosen values. @@ -60,13 +60,13 @@ This makes a kind of approval test matrix, automatically testing all combination In this small example, all combinations of `{"hello", "world"}` and `{1, 2, 3}` are being used: - + ```java String[] strings = {"hello", "world"}; Integer[] numbers = {1, 2, 3}; CombinationApprovals.verifyAllCombinations((s, i) -> String.format("(%s,%s)", s, i), strings, numbers); ``` -snippet source | anchor +snippet source | anchor The format is carefully chosen to show both inputs and outputs, to make the test results easy to interpret. The output looks like this: diff --git a/approvaltests/docs/reference/AwtApprovals.md b/approvaltests/docs/reference/AwtApprovals.md index b5e0fc4e2..3614be1a9 100644 --- a/approvaltests/docs/reference/AwtApprovals.md +++ b/approvaltests/docs/reference/AwtApprovals.md @@ -31,12 +31,12 @@ To create such a gif you pass the number of frames you want plus a function that for every frame. Here is an example for a simple expanding box: - + ```java SquareDrawer squareDrawer = new SquareDrawer(); AwtApprovals.verifySequence(5, f -> squareDrawer.setSquareSize(f * 10)); ``` -snippet source | anchor +snippet source | anchor **Note**: Method overloads allow specifying the time between frames or the time for each frame. diff --git a/approvaltests/docs/reference/IntelliJReporter.md b/approvaltests/docs/reference/IntelliJReporter.md index c20a2c6a8..836fc106d 100644 --- a/approvaltests/docs/reference/IntelliJReporter.md +++ b/approvaltests/docs/reference/IntelliJReporter.md @@ -19,12 +19,12 @@ This page exists when IntelliJ is not being found in your system. Currently, here are some of the paths that are supported: - + ```java "/Users/fakeUser/Library/Application Support/JetBrains/Toolbox/apps/IDEA-C/ch-0/223.8617.56/IntelliJ IDEA CE.app/Contents/MacOS/idea", "/Users/fakeUser/Library/Application Support/JetBrains/Toolbox/apps/IDEA-U/ch-0/223.8617.56/IntelliJ IDEA 2022.2 EAP.app" ``` -snippet source | anchor +snippet source | anchor If IntelliJ is not opening for you, diff --git a/approvaltests/docs/reference/StoryBoard.md b/approvaltests/docs/reference/StoryBoard.md index c5400cedf..f56f79ad5 100644 --- a/approvaltests/docs/reference/StoryBoard.md +++ b/approvaltests/docs/reference/StoryBoard.md @@ -13,11 +13,11 @@ StoryBoards can be very helpful to tell a story of steps that happen over time. Here is a simple example - + ```java Approvals.verify(new StoryBoard().add(gameOfLife).addFrames(3, gameOfLife::advance)); ``` -snippet source | anchor +snippet source | anchor which produces