Merge pull request #28 from kemitix/release/0.6.0

Release 0.6.0
This commit is contained in:
Paul Campbell 2018-03-04 20:14:32 +00:00 committed by GitHub
commit 802b0adf08
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 52 additions and 25 deletions

View file

@ -1,6 +1,15 @@
CHANGELOG
=========
0.6.0
-----
* Java 9 compatible
* Upgrade `assertj` to 3.9.1
* jenkins: add Coverage stage
* jenkins: split Reporting stage into Test Results and Archiving
* jenkins: remove java 9 testing from `develop` branch
0.5.1
-----

View file

@ -1,4 +1,5 @@
final String gitRepoUrl = 'git@github.com:kemitix/mon.git'
final String repoName = "mon"
final String repoUrl = "git@github.com:kemitix/${repoName}.git"
final String mvn = "mvn --batch-mode --update-snapshots"
pipeline {
@ -6,7 +7,7 @@ pipeline {
stages {
stage('Prepare') {
steps {
git url: gitRepoUrl, branch: '**', credentialsId: 'github-kemitix'
git url: repoUrl, branch: '**', credentialsId: 'github-kemitix'
}
}
stage('no SNAPSHOT in master') {
@ -26,30 +27,38 @@ pipeline {
stage('Java 8') {
steps {
withMaven(maven: 'maven 3.5.2', jdk: 'JDK 1.8') {
sh "${mvn} clean install"
}
}
}
stage('Java 9') {
steps {
withMaven(maven: 'maven 3.5.2', jdk: 'JDK 9') {
sh 'mvn clean install'
}
}
}
// requires maven-failsafe-plugin:2.21 when it is released
// stage('Java 9') {
// steps {
// withMaven(maven: 'maven 3.5.2', jdk: 'JDK 9') {
// sh 'mvn clean install'
// }
// }
// }
}
}
stage('Reporting') {
stage('Test Results') {
steps {
junit '**/target/surefire-reports/*.xml'
}
}
stage('Archiving') {
steps {
archiveArtifacts '**/target/*.jar'
}
}
stage('Coverage') {
steps {
jacoco(execPattern: '**/target/jacoco.exec')
}
}
stage('Deploy') {
when { expression { (env.GIT_BRANCH == 'master') } }
steps {
withMaven(maven: 'maven 3.5.2', jdk: 'JDK 1.8') {
withMaven(maven: 'maven 3.5.2', jdk: 'JDK 9') {
sh "${mvn} deploy --activate-profiles release -DskipTests=true"
}
}

View file

@ -10,8 +10,9 @@
<version>5.1.0</version>
<relativePath/>
</parent>
<groupId>net.kemitix</groupId>
<artifactId>mon</artifactId>
<version>0.5.1</version>
<version>0.6.0</version>
<properties>
<java.version>1.8</java.version>

View file

@ -118,17 +118,8 @@ public class Mon<T> implements Functor<T, Mon<?>> {
* @return true if they are the same
*/
@Override
@SuppressWarnings("npathcomplexity")
public boolean equals(final Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
final Mon<?> mon = (Mon<?>) o;
return value.equals(mon.value);
return this == o || o != null && getClass() == o.getClass() && value.equals(((Mon<?>) o).value);
}
}

View file

@ -93,6 +93,7 @@ public class MonTest {
}
@Test
@SuppressWarnings("ResultOfMethodCallIgnored")
public void factoryRequiresValidator() {
assertThatNullPointerException().isThrownBy(
() -> Mon.factory(null, Optional::of, Optional::empty))
@ -100,6 +101,7 @@ public class MonTest {
}
@Test
@SuppressWarnings("ResultOfMethodCallIgnored")
public void factoryRequiresOnValid() {
assertThatNullPointerException().isThrownBy(
() -> Mon.factory(v -> true, null, Optional::empty))
@ -107,12 +109,27 @@ public class MonTest {
}
@Test
@SuppressWarnings("ResultOfMethodCallIgnored")
public void factoryRequiresOnInvalid() {
assertThatNullPointerException().isThrownBy(
() -> Mon.factory(v -> true, Optional::of, null))
.withMessage("onInvalid");
}
@Test
public void factory() {
//given
final Function<Integer, Optional<?>> evenMonFactory =
Mon.factory((Integer v) -> v % 2 == 0, Optional::of, Optional::empty);
//when
final Optional<?> oddResult = evenMonFactory.apply(1);
final Optional<?> evenResult = evenMonFactory.apply(2);
//then
assertThat(oddResult).isEmpty();// because 1 % 2 != 0
assertThat(evenResult).isNotEmpty(); // because 2 % 2 == 0
evenResult.ifPresent(value -> assertThat(value).isEqualTo(Mon.of(2)));
}
@Test
public void shouldGetInvalidResultWhenFactoryApplyWithNull() {
//given

View file

@ -92,7 +92,7 @@ public class TypeAliasTest {
final String value = "value";
final AnAlias anAlias = AnAlias.of(value);
//then
assertThat(anAlias.hashCode()).isEqualTo(value.hashCode());
assertThat(anAlias).hasSameHashCodeAs(value);
}
@Test