diff --git a/.github/dependabot.yml b/.github/dependabot.yml
new file mode 100644
index 0000000..f8414ae
--- /dev/null
+++ b/.github/dependabot.yml
@@ -0,0 +1,12 @@
+version: 2
+updates:
+ - package-ecosystem: "maven"
+ directory: "/"
+ schedule:
+ interval: "daily"
+ time: "02:00"
+ - package-ecosystem: "github-actions"
+ directory: "/"
+ schedule:
+ interval: "daily"
+ time: "02:00"
diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
new file mode 100644
index 0000000..32c832c
--- /dev/null
+++ b/.github/workflows/test.yml
@@ -0,0 +1,50 @@
+# This workflow will build a Java project with Maven
+# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven
+
+name: build
+
+on:
+ push:
+ branches: [ master ]
+ pull_request:
+ branches: [ master ]
+
+jobs:
+ build:
+
+ runs-on: ubuntu-latest
+ strategy:
+ matrix:
+ java: ['17']
+
+ steps:
+ - uses: actions/checkout@v4
+ - uses: actions/cache@v3
+ with:
+ path: ~/.m2/repository
+ key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
+ restore-keys: |
+ ${{ runner.os }}-maven-
+ - name: Set up JDK
+ uses: actions/setup-java@v3
+ with:
+ distribution: 'zulu'
+ java-version: ${{ matrix.java }}
+ - name: Build with Maven
+ run: mvn -B verify --file pom.xml
+ auto-merge:
+ needs: build
+ runs-on: ubuntu-latest
+ steps:
+ - name: Check out repo
+ uses: actions/checkout@v4
+ - name: auto-merge
+ if: |
+ github.actor == 'dependabot[bot]' &&
+ github.event_name == 'pull_request'
+ run: |
+ ./merge_dependabot.sh
+ env:
+ PR_URL: ${{github.event.pull_request.html_url}}
+ # this secret needs to be in the settings.secrets.dependabot
+ GITHUB_TOKEN: ${{secrets.GH_ACTION_TOKEN}}
diff --git a/.github/workflows/updateMarkdown.yml b/.github/workflows/updateMarkdown.yml
new file mode 100644
index 0000000..33372ad
--- /dev/null
+++ b/.github/workflows/updateMarkdown.yml
@@ -0,0 +1,22 @@
+name: on-push-do-doco
+on:
+ push:
+jobs:
+ release:
+ runs-on: windows-latest
+ steps:
+ - uses: actions/checkout@v4
+ - name: Run MarkdownSnippets
+ run: |
+ dotnet tool install --global MarkdownSnippets.Tool
+ mdsnippets ${GITHUB_WORKSPACE}
+ shell: bash
+ - name: Push changes
+ run: |
+ git config --local user.email "action@github.com"
+ git config --local user.name "GitHub Action"
+ git commit -m "Doco changes" -a || echo "nothing to commit"
+ remote="https://${GITHUB_ACTOR}:${{secrets.GITHUB_TOKEN}}@github.com/${GITHUB_REPOSITORY}.git"
+ branch="${GITHUB_REF:11}"
+ git push "${remote}" ${branch} || echo "nothing to push"
+ shell: bash
diff --git a/.gitignore b/.gitignore
new file mode 100755
index 0000000..d94e1d8
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,11 @@
+*.class
+.settings
+.preferences
+.classpath
+.project
+target
+.idea
+*.iml
+
+*.received.*
+.DS_Store
diff --git a/Launching.md b/Launching.md
new file mode 100644
index 0000000..28d1c75
--- /dev/null
+++ b/Launching.md
@@ -0,0 +1 @@
+[Launch Me](https://us-east-2.console.aws.amazon.com/cloudformation/home?region=us-east-2#/stacks/create/review?templateURL=https://raw.githubusercontent.com/approvals/ApprovalTests.java.StarterProject/master/launch.ec2.yml&stackName=approvaltests-java-starterproject)
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..ca03b2d
--- /dev/null
+++ b/README.md
@@ -0,0 +1,30 @@
+# ApprovalTests.java.StarterProject
+
+[![Build Status](../../workflows/build/badge.svg?branch=main)](../../actions?query=build%3Amain)
+
+
+This is a starter project for:
+
+* ApprovalTests in java - see [ApprovalTests.java](https://github.com/approvals/ApprovalTests.java)
+* Junit
+* Maven
+
+Works on Mac, Linux and Windows.
+
+Feel free to copy and go...
+
+## Starting Point
+
+The tests in [SampleTests](https://github.com/approvals/ApprovalTests.java.StarterProject/blob/master/src/test/java/org/samples/SampleTests.java) should pass, and then you should delete/modify as needed to get started.
+
+
+Notes:
+
+* For more information, see the [ApprovalTests.java User Guide](https://github.com/approvals/ApprovalTests.Java/blob/master/approvaltests/docs/README.md#top)
+* You will need a Diff tool.
+* Suggestions:
+ * Mac: [DiffMerge](https://sourcegear.com/diffmerge/)
+ * Windows: [WinMerge](winmerge.org/)
+ * Linux: [meld](http://meldmerge.org/)
+
+
diff --git a/install.windows.ps1 b/install.windows.ps1
new file mode 100644
index 0000000..fe5a09f
--- /dev/null
+++ b/install.windows.ps1
@@ -0,0 +1,17 @@
+# To run this script directly, run this in an elevated admin PowerShell prompt:
+# Invoke-WebRequest -UseBasicParsing https://raw.githubusercontent.com/approvals/ApprovalTests.java.StarterProject/master/install.windows.ps1 | Invoke-Expression
+
+# This script is intended to setup a dev machine from scratch. Very useful for setting up a EC2 instance for mobbing.
+#
+
+
+iwr -useb https://raw.githubusercontent.com/JayBazuzi/machine-setup/main/windows.ps1 | iex
+iwr -useb https://raw.githubusercontent.com/JayBazuzi/machine-setup/main/java-intellij.ps1 | iex
+
+
+# Clone repo
+& "C:\Program Files\Git\cmd\git.exe" clone https://github.com/approvals/ApprovalTests.java.StarterProject.git C:\Code\ApprovalTests.java.StarterProject
+
+# Done
+cls
+echo "Done!"
diff --git a/launch.ec2.yml b/launch.ec2.yml
new file mode 100644
index 0000000..16dbd5c
--- /dev/null
+++ b/launch.ec2.yml
@@ -0,0 +1,87 @@
+# http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/sample-templates-services-us-west-2.html#w1ab2c21c45c15c15
+# Amazon EC2 instance in a security group Creates an Amazon EC2 instance in an Amazon EC2 security group.
+---
+AWSTemplateFormatVersion: '2010-09-09'
+Description: 'AWS CloudFormation Sample Template EC2InstanceWithSecurityGroupSample:
+ Create an Amazon EC2 instance running the Amazon Linux AMI. The AMI is chosen based
+ on the region in which the stack is run. This example creates an EC2 security group
+ for the instance to give you SSH access. **WARNING** This template creates an Amazon
+ EC2 instance. You will be billed for the AWS resources used if you create a stack
+ from this template.'
+Parameters:
+ KeyName:
+ Description: Name of an existing EC2 KeyPair to enable SSH access to the instance
+ Type: AWS::EC2::KeyPair::KeyName
+ ConstraintDescription: must be the name of an existing EC2 KeyPair.
+ InstanceType:
+ Description: WebServer EC2 instance type
+ Type: String
+ Default: t2.xlarge
+ AllowedValues:
+ - t2.large
+ - t2.xlarge
+ ConstraintDescription: must be a valid EC2 instance type.
+ SSHLocation:
+ Description: The IP address range that can be used to SSH to the EC2 instances
+ Type: String
+ MinLength: '9'
+ MaxLength: '18'
+ Default: 0.0.0.0/0
+ AllowedPattern: "(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})/(\\d{1,2})"
+ ConstraintDescription: must be a valid IP CIDR range of the form x.x.x.x/x.
+Mappings:
+ AWSInstanceType2Arch:
+ t2.large:
+ Arch: HVM64
+ t2.xlarge:
+ Arch: HVM64
+Resources:
+ EC2Instance:
+ Type: AWS::EC2::Instance
+ Properties:
+ InstanceType:
+ Ref: InstanceType
+ SecurityGroups:
+ - Ref: InstanceSecurityGroup
+ KeyName:
+ Ref: KeyName
+ ImageId: ami-0db6a09e9ade44bb3
+ Tags:
+ - Key: Name
+ Value: ApprovalTests.java.StarterProject
+ UserData:
+ Fn::Base64: Invoke-WebRequest -UseBasicParsing https://raw.githubusercontent.com/approvals/ApprovalTests.java/master/install.windows.ps1 | Invoke-Expression
+ InstanceSecurityGroup:
+ Type: AWS::EC2::SecurityGroup
+ Properties:
+ GroupDescription: Enable RDP access via port 3389
+ SecurityGroupIngress:
+ - IpProtocol: tcp
+ FromPort: '3389'
+ ToPort: '3389'
+ CidrIp:
+ Ref: SSHLocation
+Outputs:
+ InstanceId:
+ Description: InstanceId of the newly created EC2 instance
+ Value:
+ Ref: EC2Instance
+ AZ:
+ Description: Availability Zone of the newly created EC2 instance
+ Value:
+ Fn::GetAtt:
+ - EC2Instance
+ - AvailabilityZone
+ PublicDNS:
+ Description: Public DNSName of the newly created EC2 instance
+ Value:
+ Fn::GetAtt:
+ - EC2Instance
+ - PublicDnsName
+
+ PublicIP:
+ Description: Public IP address of the newly created EC2 instance
+ Value:
+ Fn::GetAtt:
+ - EC2Instance
+ - PublicIp
\ No newline at end of file
diff --git a/mdsnippets.json b/mdsnippets.json
new file mode 100644
index 0000000..27dddee
--- /dev/null
+++ b/mdsnippets.json
@@ -0,0 +1,5 @@
+{
+ "ExcludeDirectories": [ "target" ],
+ "Convention": "InPlaceOverwrite",
+ "TocLevel": 5
+}
diff --git a/merge_dependabot.sh b/merge_dependabot.sh
new file mode 100755
index 0000000..c62e298
--- /dev/null
+++ b/merge_dependabot.sh
@@ -0,0 +1,10 @@
+#!/bin/sh
+
+gh pr merge --auto --rebase "$PR_URL"
+
+if [ $? -ne 0 ]
+then
+ echo 'if you want github to automatically merge pull requests from dependabot, you need to create a'
+ echo 'personal access token (public_repo) and assign it to settings -> secrets -> dependabot -> GH_ACTION_TOKEN'
+fi
+
diff --git a/pom.xml b/pom.xml
new file mode 100644
index 0000000..1140fae
--- /dev/null
+++ b/pom.xml
@@ -0,0 +1,58 @@
+
+
+ 4.0.0
+
+ starterproject
+ EarlyReturnKata
+ 1.0-SNAPSHOT
+
+
+
+ org.apache.maven.plugins
+ maven-compiler-plugin
+
+
+ 17
+
+
+
+ maven-surefire-plugin
+ 3.1.2
+
+
+
+
+
+ com.approvaltests
+ approvaltests
+ 19.0.0
+
+
+ com.google.code.gson
+ gson
+ 2.10.1
+ test
+
+
+ org.junit.jupiter
+ junit-jupiter
+ 5.10.0
+ test
+
+
+
+
+
+ download-sources
+
+ true
+ true
+
+
+ true
+
+
+
+
+
diff --git a/src/main/java/org/samples/Person.java b/src/main/java/org/samples/Person.java
new file mode 100644
index 0000000..eac5ee0
--- /dev/null
+++ b/src/main/java/org/samples/Person.java
@@ -0,0 +1,32 @@
+package org.samples;
+
+public class Person
+{
+ private final String firstName;
+ private final String lastName;
+ private final boolean isMale;
+ private final int age;
+ public Person(String firstName, String lastName, boolean isMale, int age)
+ {
+ this.firstName = firstName;
+ this.lastName = lastName;
+ this.isMale = isMale;
+ this.age = age;
+ }
+ public String getFirstName()
+ {
+ return firstName;
+ }
+ public String getLastName()
+ {
+ return lastName;
+ }
+ public boolean isMale()
+ {
+ return isMale;
+ }
+ public int getAge()
+ {
+ return age;
+ }
+}
diff --git a/src/test/java/org/samples/PackageSettings.java b/src/test/java/org/samples/PackageSettings.java
new file mode 100644
index 0000000..52344ac
--- /dev/null
+++ b/src/test/java/org/samples/PackageSettings.java
@@ -0,0 +1,13 @@
+package org.samples;
+
+import org.approvaltests.core.ApprovalFailureReporter;
+import org.approvaltests.reporters.DiffReporter;
+
+/**
+ * Here you can set the default reporter used for everything
+ * starting with org.samples.* including sub-packages
+ **/
+public class PackageSettings
+{
+ public ApprovalFailureReporter UseReporter = DiffReporter.INSTANCE;
+}
diff --git a/src/test/java/org/samples/SampleTests.java b/src/test/java/org/samples/SampleTests.java
new file mode 100755
index 0000000..ea27578
--- /dev/null
+++ b/src/test/java/org/samples/SampleTests.java
@@ -0,0 +1,31 @@
+package org.samples;
+
+
+import org.approvaltests.Approvals;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
+public class SampleTests
+{
+ @Test
+ public void testNormalJunit()
+ {
+ assertEquals(5, 5);
+ }
+ @Test
+ public void testWithApprovalTests()
+ {
+ Approvals.verify("Hello World");
+ }
+ /**
+ * note: this requires GSON which is currently added in the pom.xml file.
+ * This is only required if you want to use the VerifyAsJson.
+ **/
+ @Test
+ public void testJson()
+ {
+ Person hero = new Person("jayne", "cobb", true, 38);
+ Approvals.verifyAsJson(hero);
+ }
+}
diff --git a/src/test/java/org/samples/SampleTests.testJson.approved.json b/src/test/java/org/samples/SampleTests.testJson.approved.json
new file mode 100644
index 0000000..ae3b91c
--- /dev/null
+++ b/src/test/java/org/samples/SampleTests.testJson.approved.json
@@ -0,0 +1,6 @@
+{
+ "firstName": "jayne",
+ "lastName": "cobb",
+ "isMale": true,
+ "age": 38
+}
diff --git a/src/test/java/org/samples/SampleTests.testWithApprovalTests.approved.txt b/src/test/java/org/samples/SampleTests.testWithApprovalTests.approved.txt
new file mode 100644
index 0000000..557db03
--- /dev/null
+++ b/src/test/java/org/samples/SampleTests.testWithApprovalTests.approved.txt
@@ -0,0 +1 @@
+Hello World