Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version: 2,
version: 2
updates:
- package-ecosystem: "gradle"
directory: "/"
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ jobs:
WITH_V: false
DRY_RUN: true
- name: publish
continue-on-error: true
env:
SNAPSHOT_VERSION: ${{ steps.tag_version_dry_run.outputs.tag }}-SNAPSHOT
ORG_GRADLE_PROJECT_signingKey: ${{ secrets.GPG_PRIVATE_KEY_ASCII_ARMOR }}
Expand Down
2 changes: 0 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ jobs:
RELEASE_VERSION: ${{ steps.tag_version_dry_run.outputs.tag }}
run: ./gradlew shadowJar -Pversion=$RELEASE_VERSION
- name: Publish to Maven Central
continue-on-error: true
env:
ORG_GRADLE_PROJECT_signingKey: ${{ secrets.GPG_PRIVATE_KEY_ASCII_ARMOR }}
ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.GPG_KEY_PASSPHRASE }}
Expand All @@ -37,7 +36,6 @@ jobs:
RELEASE_VERSION: ${{ steps.tag_version_dry_run.outputs.tag }}
run: ./gradlew -Pversion=$RELEASE_VERSION publish -PossrhUsername=${MAVEN_CENTRAL_TOKEN_USERNAME} -PossrhPassword=${MAVEN_CENTRAL_TOKEN_PASSWORD} -Psign=true
- name: Close & Release Staging Repository
continue-on-error: true
env:
MAVEN_CENTRAL_TOKEN_USERNAME: ${{ secrets.MAVEN_CENTRAL_TOKEN_USERNAME }}
MAVEN_CENTRAL_TOKEN_PASSWORD: ${{ secrets.MAVEN_CENTRAL_TOKEN_PASSWORD }}
Expand Down
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ We welcome contributions to this project by both internal and external parties
1. Ensure Github Actions build passes
1. Await reviews
1. Once merged into `master` a `SNAPSHOT` build will be available for consumption
immediately [here](https://oss.sonatype.org/content/repositories/snapshots/io/github/origin-energy/). Note that
immediately [here](https://oss.sonatype.org/content/repositories/snapshots/io/github/codedabble-dev/). Note that
snapshots change regularly and cannot be relied upon.
1. Hard Releases will be made once enough features have been added.

Expand Down Expand Up @@ -71,7 +71,7 @@ export ORG_GRADLE_PROJECT_signingPassword=?
## Releasing [Full Tutorial](https://central.sonatype.org/pages/ossrh-guide.html)

1. Login to SONAR (https://oss.sonatype.org)
1. Click 'Staging Repositories' and locate the 'iogithuborigin-energy' bundle
1. Click 'Staging Repositories' and locate the 'iogithubcodedabble-dev' bundle
1. Review artifacts are correct in the 'Content' tab
1. Press the 'Close' and give a reason such as "Jack Matthews - Confirmed artifacts are OK"
1. Wait for about 1 min and press the 'Refresh button', if all sanity checks have passed the 'Release' button will be
Expand Down
2 changes: 1 addition & 1 deletion LATEST_SNAPSHOT.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@ dependencies {

// Replace {FRAMEWORK} with you testing framework
// Replace {X.X.X} with the version number from `/gradle.properties`
testCompile "io.github.origin-energy:java-snapshot-testing-{FRAMEWORK}:{X.X.X}-SNAPSHOT"
testCompile "io.github.codedabble-dev:java-snapshot-testing-{FRAMEWORK}:{X.X.X}-SNAPSHOT"
}
```
49 changes: 28 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,20 @@
[![Build Status](https://github.com/origin-energy/java-snapshot-testing/workflows/build/badge.svg)](https://github.com/origin-energy/java-snapshot-testing/actions)
[![JitPack](https://jitpack.io/v/origin-energy/java-snapshot-testing.svg)](https://jitpack.io/#origin-energy/java-snapshot-testing)
[![Build Status](https://github.com/codedabble-dev/java-snapshot-testing/workflows/build/badge.svg)](https://github.com/codedabble-dev/java-snapshot-testing/actions)
[![Maven Central](https://img.shields.io/maven-central/v/io.github.codedabble-dev/java-snapshot-testing-core.svg)](https://central.sonatype.com/artifact/io.github.codedabble-dev/java-snapshot-testing-core)
[![JitPack](https://jitpack.io/v/codedabble-dev/java-snapshot-testing.svg)](https://jitpack.io/#codedabble-dev/java-snapshot-testing)

> [!IMPORTANT]
> The Maven Central namespace has changed from [`io.github.origin-energy`](https://central.sonatype.com/namespace/io.github.origin-energy) to [`io.github.codedabble-dev`](https://central.sonatype.com/namespace/io.github.codedabble-dev).
> Update your build dependencies to use the new `io.github.codedabble-dev` group ID.

# Java Snapshot Testing
- Inspired by [facebook's Jest framework](https://facebook.github.io/jest/docs/en/snapshot-testing.html)

🎉 4.+ is out

## Upgrading
- Upgrade guide from 3.X to 4.X [here](https://github.com/origin-energy/java-snapshot-testing/discussions/94)
- Upgrade guide from 2.X to 3.X [here](https://github.com/origin-energy/java-snapshot-testing/discussions/73)
- Upgrade guide from 2.X-BETA to 2.X [here](https://github.com/origin-energy/java-snapshot-testing/discussions/58)
- Upgrade guide from 3.X to 4.X [here](https://github.com/codedabble-dev/java-snapshot-testing/discussions/94)
- Upgrade guide from 2.X to 3.X [here](https://github.com/codedabble-dev/java-snapshot-testing/discussions/73)
- Upgrade guide from 2.X-BETA to 2.X [here](https://github.com/codedabble-dev/java-snapshot-testing/discussions/58)

## The testing framework loved by ~~lazy~~ __productive__ devs

Expand All @@ -26,22 +31,22 @@ Then java-snapshot-testing might just be what you are looking for!

```groovy
repositories {
maven { url 'https://jitpack.io' }
mavenCentral()
}

// In this case we are using the JUnit5 testing framework
testImplementation 'com.github.origin-energy.java-snapshot-testing:java-snapshot-testing-junit5:4.+'
testImplementation 'io.github.codedabble-dev:java-snapshot-testing-junit5:4.+'

// slf4j logging implementation if you don't already have one
testImplementation("org.slf4j:slf4j-simple:2.0.0-alpha0")

// Optional: Many will want to serialize into JSON. In this case you should also add the Jackson plugin
testImplementation 'com.github.origin-energy.java-snapshot-testing:java-snapshot-testing-plugin-jackson3:4.+'
testImplementation 'io.github.codedabble-dev:java-snapshot-testing-plugin-jackson3:4.+'
testImplementation 'tools.jackson.core:jackson-core:3.1.0'
testImplementation 'tools.jackson.core:jackson-databind:3.1.0'

// For Jackson 2 use the dedicated plugin and serializer classes instead
testImplementation 'com.github.origin-energy.java-snapshot-testing:java-snapshot-testing-plugin-jackson:4.+'
testImplementation 'io.github.codedabble-dev:java-snapshot-testing-plugin-jackson:4.+'
testImplementation 'com.fasterxml.jackson.core:jackson-core:2.11.3'
testImplementation 'com.fasterxml.jackson.core:jackson-databind:2.11.3'

Expand Down Expand Up @@ -146,13 +151,13 @@ data.
- Does not give great insight to why the snapshot failed
- Can be difficult to troll though large snapshot changes where you might only be interested in a small set of fields

## Installation [JitPack](https://jitpack.io/#origin-energy/java-snapshot-testing)
## Installation [Maven Central](https://central.sonatype.com/search?q=io.github.codedabble-dev)

Add JitPack to your build repositories:
Add Maven Central to your build repositories:

```groovy
repositories {
maven { url 'https://jitpack.io' }
mavenCentral()
}
```

Expand All @@ -161,30 +166,32 @@ Then add the module for your test framework. The `4.+` version uses the latest a
Only if you want to integrate with an unsupported framework. [Show me how!](#using-an-unsupported-framework)

```groovy
testImplementation 'com.github.origin-energy.java-snapshot-testing:java-snapshot-testing-core:4.+'
testImplementation 'io.github.codedabble-dev:java-snapshot-testing-core:4.+'
```

We currently support:

```groovy
testImplementation 'com.github.origin-energy.java-snapshot-testing:java-snapshot-testing-junit4:4.+'
testImplementation 'com.github.origin-energy.java-snapshot-testing:java-snapshot-testing-junit5:4.+'
testImplementation 'com.github.origin-energy.java-snapshot-testing:java-snapshot-testing-spock:4.+'
testImplementation 'io.github.codedabble-dev:java-snapshot-testing-junit4:4.+'
testImplementation 'io.github.codedabble-dev:java-snapshot-testing-junit5:4.+'
testImplementation 'io.github.codedabble-dev:java-snapshot-testing-spock:4.+'
```

JitPack remains available as an alternative install route at [jitpack.io/#codedabble-dev/java-snapshot-testing](https://jitpack.io/#codedabble-dev/java-snapshot-testing).

Plugins

- Jackson for JSON serialization
- Jackson 3 for JSON serialization
- [Jackson for JSON serialization](https://central.sonatype.com/artifact/io.github.codedabble-dev/java-snapshot-testing-plugin-jackson)
- [Jackson 3 for JSON serialization](https://central.sonatype.com/artifact/io.github.codedabble-dev/java-snapshot-testing-plugin-jackson3)
- You need jackson on your classpath (Gradle example)
```groovy
// Jackson 2 plugin
testImplementation 'com.github.origin-energy.java-snapshot-testing:java-snapshot-testing-plugin-jackson:4.+'
testImplementation 'io.github.codedabble-dev:java-snapshot-testing-plugin-jackson:4.+'
testImplementation 'com.fasterxml.jackson.core:jackson-core:2.11.3'
testImplementation 'com.fasterxml.jackson.core:jackson-databind:2.11.3'

// Jackson 3 plugin
testImplementation 'com.github.origin-energy.java-snapshot-testing:java-snapshot-testing-plugin-jackson3:4.+'
testImplementation 'io.github.codedabble-dev:java-snapshot-testing-plugin-jackson3:4.+'
testImplementation 'tools.jackson.core:jackson-core:3.1.0'
testImplementation 'tools.jackson.core:jackson-databind:3.1.0'
```
Expand Down Expand Up @@ -339,7 +346,7 @@ public class JUnit4RulesExample {
}
```

See the [ParameterizedTest](https://github.com/origin-energy/java-snapshot-testing/blob/master/java-snapshot-testing-junit4/src/test/java/au/com/origin/snapshots/ParameterizedTest.java) for an example implementation
See the [ParameterizedTest](https://github.com/codedabble-dev/java-snapshot-testing/blob/master/java-snapshot-testing-junit4/src/test/java/au/com/origin/snapshots/ParameterizedTest.java) for an example implementation

## [Spock](http://spockframework.org/)

Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
group=io.github.origin-energy
group=io.github.codedabble-dev
version=0.0.0-SNAPSHOT
19 changes: 12 additions & 7 deletions gradle/publishing.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ publishing {
pom {
name = 'java-snapshot-testing'
description = 'Snapshot Testing for Java'
url = 'https://github.com/origin-energy/java-snapshot-testing'
url = 'https://github.com/codedabble-dev/java-snapshot-testing'

scm {
connection = 'scm:git:https://github.com/origin-energy/java-snapshot-testing'
url = 'https://github.com/origin-energy/java-snapshot-testing'
connection = 'scm:git:https://github.com/codedabble-dev/java-snapshot-testing'
url = 'https://github.com/codedabble-dev/java-snapshot-testing'
}

licenses {
Expand All @@ -36,7 +36,7 @@ publishing {
developer {
id = 'jack.matthews'
name = 'Jack Matthews'
email = 'jack.matthews@origin.com.au'
email = 'dev@codedabble.com'
}
}

Expand Down Expand Up @@ -66,13 +66,17 @@ afterEvaluate {
}

if (project.hasProperty("ossrhUsername") && project.hasProperty("ossrhPassword")) {
def snapshotRepositoryUrl = 'https://central.sonatype.com/repository/maven-snapshots/'
def releaseRepositoryUrl = 'https://ossrh-staging-api.central.sonatype.com/service/local/staging/deploy/maven2/'
def stagingServerUrl = 'https://ossrh-staging-api.central.sonatype.com/service/local/'

publishing {
repositories {
maven {
name = 'sonatype'
url = uri(project.version.toString().endsWith('-SNAPSHOT')
? 'https://oss.sonatype.org/content/repositories/snapshots/'
: 'https://oss.sonatype.org/service/local/staging/deploy/maven2/')
? snapshotRepositoryUrl
: releaseRepositoryUrl)
credentials {
username = project.property("ossrhUsername")
password = project.property("ossrhPassword")
Expand All @@ -82,8 +86,9 @@ if (project.hasProperty("ossrhUsername") && project.hasProperty("ossrhPassword")
}

nexusStaging {
serverUrl stagingServerUrl
username project.property("ossrhUsername")
password project.property("ossrhPassword")
packageGroup 'io.github.origin-energy'
packageGroup 'io.github.codedabble-dev'
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ public class LogGithubIssueException extends RuntimeException {

private static final String LOG_SUPPORT_TICKET =
"\n\n*** This exception should never be thrown ***\n"
+ "Log a support ticket at https://github.com/origin-energy/java-snapshot-testing/issues with details of the exception\n";
+ "Log a support ticket at https://github.com/codedabble-dev/java-snapshot-testing/issues with details of the exception\n";

public LogGithubIssueException(String message) {
super(message + LOG_SUPPORT_TICKET);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ private boolean shouldFailOnOrphans(ExtensionContext context) {
"FAILED: (Java Snapshot Testing) Unable to get JUnit5 ClassTestDescriptor or ClassBasedTestDescriptor!\n"
+ "Ensure you are using Junit5 >= 5.3.2\n"
+ "This may be due to JUnit5 changing their private api as we use reflection to access it\n"
+ "Log a support ticket https://github.com/origin-energy/java-snapshot-testing/issues and supply your JUnit5 version\n"
+ "Log a support ticket https://github.com/codedabble-dev/java-snapshot-testing/issues and supply your JUnit5 version\n"
+ "Setting failOnOrphans=true as this is the safest option."
+ "This means that running a test alone (say from the IDE) will fail the snapshot, you need to run the entire class.",
e);
Expand Down
Loading