-
Notifications
You must be signed in to change notification settings - Fork 70
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into ckozak/gh172
- Loading branch information
Showing
31 changed files
with
365 additions
and
150 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
version: 2 | ||
updates: | ||
- package-ecosystem: maven | ||
directory: "/" | ||
schedule: | ||
interval: daily | ||
open-pull-requests-limit: 10 | ||
ignore: | ||
- dependency-name: junit:junit | ||
versions: | ||
- 3.8.2 | ||
- 4.13.2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
name: Maven Build | ||
|
||
on: | ||
pull_request: | ||
branches: [ "master" ] | ||
merge_group: | ||
types: [checks_requested] | ||
|
||
jobs: | ||
build: | ||
name: Java ${{ matrix.java }} build | ||
runs-on: ubuntu-latest | ||
continue-on-error: ${{ matrix.experimental }} | ||
strategy: | ||
fail-fast: true | ||
matrix: | ||
java: [ 8, 11 ] | ||
experimental: [false] | ||
include: | ||
- java: 17 | ||
experimental: true | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Set up JDK ${{ matrix.java }} | ||
uses: actions/setup-java@v3 | ||
with: | ||
java-version: ${{ matrix.java }} | ||
distribution: 'temurin' | ||
cache: maven | ||
- name: Build with Maven | ||
run: mvn --no-transfer-progress --batch-mode package --file pom.xml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
name: Maven deploy release | ||
# Reset before repeated testing | ||
# git push --delete origin 2.13.0 | ||
# git push -d origin release/2.13.0 release/2.13.0-snapshot | ||
on: | ||
push: | ||
branches: [ "release/*" ] | ||
jobs: | ||
deploy: | ||
# Avoid loops | ||
if: github.event.commits[0].author.email != '[email protected]' | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Set up Maven Central Repository | ||
uses: actions/setup-java@v3 | ||
with: | ||
java-version: '8' | ||
distribution: 'temurin' | ||
cache: maven | ||
server-id: ossrh | ||
server-username: MAVEN_USERNAME | ||
server-password: MAVEN_PASSWORD | ||
gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }} # Value of the GPG private key to import | ||
gpg-passphrase: MAVEN_GPG_PASSPHRASE # env variable for GPG private key passphrase | ||
|
||
- name: Split branch into release version | ||
env: | ||
BRANCH: ${{ github.ref_name }} | ||
id: split | ||
run: echo "fragment=${BRANCH##*/}" >> $GITHUB_OUTPUT | ||
|
||
- name: Configure git user | ||
run: | | ||
git config user.email "[email protected]" | ||
git config user.name "GitHub Actions (run by ${{ github.actor }})" | ||
- name: Maven set release version | ||
env: | ||
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }} | ||
MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }} | ||
GH_TOKEN: ${{ github.token }} | ||
MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }} | ||
run: | | ||
mvn --no-transfer-progress versions:set -DoldVersion=\* -DnewVersion=${{ steps.split.outputs.fragment }} -DgroupId=org.jmock -DgenerateBackupPoms=false | ||
git add . | ||
git commit --no-edit -m "Release version ${{ steps.split.outputs.fragment }}" | ||
git tag -a -m "Release version ${{ steps.split.outputs.fragment }}" ${{ steps.split.outputs.fragment }} | ||
mvn --no-transfer-progress --batch-mode deploy -P release | ||
mvn versions:set -DoldVersion=* -DnextSnapshot=true -DgroupId=org.jmock -DgenerateBackupPoms=false | ||
git checkout -b ${{ github.ref_name }}-snapshot | ||
git add . | ||
git commit --no-edit -m "Open development for next release" | ||
git push origin ${{ github.ref_name }} HEAD --tags | ||
gh pr create --repo jmock-developers/jmock-library -B master --title 'Merge ${{ github.ref_name }} back into master' --body 'Created by Github action' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
name: Maven deploy snapshot | ||
on: | ||
push: | ||
branches: [ master ] | ||
jobs: | ||
publish: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Set up Maven Central Repository | ||
uses: actions/setup-java@v3 | ||
with: | ||
java-version: '8' | ||
distribution: 'temurin' | ||
cache: maven | ||
server-id: ossrh | ||
# used for signing the testjar | ||
gpg-passphrase: secret | ||
server-username: MAVEN_USERNAME | ||
server-password: MAVEN_PASSWORD | ||
|
||
- name: Publish package | ||
run: mvn --no-transfer-progress --batch-mode deploy | ||
env: | ||
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }} | ||
MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<parent> | ||
<groupId>org.jmock</groupId> | ||
<artifactId>jmock-parent</artifactId> | ||
<version>2.13.1-SNAPSHOT</version> | ||
</parent> | ||
|
||
<artifactId>jmock-imposters-testdata</artifactId> | ||
|
||
<properties> | ||
<scala.version>2.13.13</scala.version> | ||
</properties> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>org.scala-lang</groupId> | ||
<artifactId>scala-library</artifactId> | ||
<version>${scala.version}</version> | ||
</dependency> | ||
</dependencies> | ||
|
||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>net.alchim31.maven</groupId> | ||
<artifactId>scala-maven-plugin</artifactId> | ||
<version>4.8.1</version> | ||
<executions> | ||
<execution> | ||
<goals> | ||
<goal>compile</goal> | ||
<goal>testCompile</goal> | ||
</goals> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
</project> |
3 changes: 3 additions & 0 deletions
3
jmock-imposters-testdata/src/main/scala/org/jmock/testdata/scalaexample/BadlyAnnotated.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
package org.jmock.testdata.scalaexample | ||
|
||
case class BadlyAnnotated(@FieldOnly badlyAnnotated: String) |
12 changes: 12 additions & 0 deletions
12
jmock-imposters-testdata/src/main/scala/org/jmock/testdata/scalaexample/FieldOnly.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package org.jmock.testdata.scalaexample; | ||
|
||
import java.lang.annotation.ElementType; | ||
import java.lang.annotation.Retention; | ||
import java.lang.annotation.RetentionPolicy; | ||
import java.lang.annotation.Target; | ||
|
||
@Retention(RetentionPolicy.RUNTIME) | ||
@Target(ElementType.FIELD) | ||
public @interface FieldOnly { | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
...mposters-tests/src/test/java/org/jmock/test/acceptance/BadAnnotationsAcceptanceTests.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package org.jmock.test.acceptance; | ||
|
||
import org.jmock.Expectations; | ||
import org.jmock.Mockery; | ||
import org.jmock.api.Imposteriser; | ||
import org.jmock.test.unit.lib.legacy.CodeGeneratingImposteriserParameterResolver; | ||
import org.jmock.testdata.scalaexample.BadlyAnnotated; | ||
import org.junit.jupiter.params.ParameterizedTest; | ||
import org.junit.jupiter.params.provider.ArgumentsSource; | ||
|
||
import static org.junit.Assert.assertSame; | ||
|
||
public class BadAnnotationsAcceptanceTests { | ||
Mockery context = new Mockery(); | ||
|
||
@ParameterizedTest | ||
@ArgumentsSource(CodeGeneratingImposteriserParameterResolver.class) | ||
public void shouldMockScalaCaseClassWithFieldAnnotationOnParameter(Imposteriser imposteriser) { | ||
context.setImposteriser(imposteriser); | ||
|
||
final BadlyAnnotated mock = context.mock(BadlyAnnotated.class); | ||
final String result = "a mock result"; | ||
context.checking(new Expectations() { | ||
{ | ||
oneOf(mock).badlyAnnotated(); | ||
will(returnValue(result)); | ||
} | ||
}); | ||
|
||
assertSame(mock.badlyAnnotated(), result); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.