From 0617c8d6730b3fa94defdaf3c8c1a0c9e2f2c8c1 Mon Sep 17 00:00:00 2001 From: Paul Campbell Date: Sat, 25 Aug 2018 15:15:33 +0100 Subject: [PATCH 1/4] pom: rearrange entries --- pom.xml | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/pom.xml b/pom.xml index af10a3e..2bde308 100644 --- a/pom.xml +++ b/pom.xml @@ -3,6 +3,16 @@ 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"> 4.0.0 + + net.kemitix + kemitix-parent + 5.1.1 + + + + conditional + DEV-SNAPSHOT + 4.1.1 5-complexity @@ -19,15 +29,6 @@ 1.18.2 - - net.kemitix - kemitix-parent - 5.1.1 - - - conditional - DEV-SNAPSHOT - org.projectlombok From 6b4b98cc132e5ad0b20003383eded3b029c226c0 Mon Sep 17 00:00:00 2001 From: Paul Campbell Date: Sat, 25 Aug 2018 15:25:25 +0100 Subject: [PATCH 2/4] Remove deprecated methods --- .../net/kemitix/conditional/Condition.java | 36 ------------- .../java/net/kemitix/conditional/Value.java | 13 ----- .../kemitix/conditional/ConditionalTest.java | 12 ++--- .../net/kemitix/conditional/ValueTest.java | 53 +++++++++++-------- 4 files changed, 37 insertions(+), 77 deletions(-) diff --git a/src/main/java/net/kemitix/conditional/Condition.java b/src/main/java/net/kemitix/conditional/Condition.java index 4fe2d15..62b8f91 100644 --- a/src/main/java/net/kemitix/conditional/Condition.java +++ b/src/main/java/net/kemitix/conditional/Condition.java @@ -45,18 +45,6 @@ public interface Condition { return FalseCondition.FALSE; } - /** - * Create a new {@code Condition} for the boolean opposite of the clause. - * - * @param clause the condition to test - * @return the Condition - * @deprecated use {@link #not()} - */ - @Deprecated - static Condition whereNot(final boolean clause) { - return where(clause).not(); - } - /** * Checks if the Condition is true or not. * @@ -98,18 +86,6 @@ public interface Condition { return Condition.where(isTrue()).and(other::isTrue); } - /** - * Logically AND combine the current {@code Condition} with boolean opposite of the clause. - * - * @param clause the condition to test - * @return the Condition - * @deprecated use {@link #not()} - */ - @Deprecated - default Condition andNot(final Supplier clause) { - return and(clause).not(); - } - /** * Logically OR combine the current {@code Condition} with the clause. * @@ -129,18 +105,6 @@ public interface Condition { return where(isTrue()).or(other::isTrue); } - /** - * Logically OR combine the current {@code Condition} with the boolean opposite of the clause. - * - * @param clause the condition to test - * @return the Condition - * @deprecated use {@link #not()} - */ - @Deprecated - default Condition orNot(final Supplier clause) { - return or(clause).not(); - } - /** * Perform this response if the {@code Condition} is {@code true}. * diff --git a/src/main/java/net/kemitix/conditional/Value.java b/src/main/java/net/kemitix/conditional/Value.java index cf8b263..7ca7240 100644 --- a/src/main/java/net/kemitix/conditional/Value.java +++ b/src/main/java/net/kemitix/conditional/Value.java @@ -124,19 +124,6 @@ public interface Value { return Value.where(clause.isTrue()); } - /** - * Create a new {@link ValueClause} for the boolean opposite of the clause. - * - * @param clause the condition to test - * @param the type of the value - * @return a true or false value clause - * @deprecated use {@link #where(boolean)}.{@link ValueClause#not()} - */ - @Deprecated - static ValueClause whereNot(final boolean clause) { - return Value.where(clause).not(); - } - /** * An intermediate state in determining the final {@link Value}. * diff --git a/src/test/java/net/kemitix/conditional/ConditionalTest.java b/src/test/java/net/kemitix/conditional/ConditionalTest.java index 6ddc282..8b0c3be 100644 --- a/src/test/java/net/kemitix/conditional/ConditionalTest.java +++ b/src/test/java/net/kemitix/conditional/ConditionalTest.java @@ -121,7 +121,7 @@ public class ConditionalTest implements WithAssertions { @Test public void whereNotFalseThenRuns() { //when - Condition.whereNot(false) + Condition.where(false).not() .then(thenResponse); //then assertThatTheThenResponseRuns(); @@ -130,7 +130,7 @@ public class ConditionalTest implements WithAssertions { @Test public void whereNotTrueThenOtherwiseRuns() { //when - Condition.whereNot(true) + Condition.where(true).not() .then(thenResponse) .otherwise(otherwiseResponse); //then @@ -141,7 +141,7 @@ public class ConditionalTest implements WithAssertions { public void whereTrueAndNotFalseThenRuns() { //when Condition.where(true) - .andNot(() -> false) + .and(() -> false).not() .then(thenResponse); //then assertThatTheThenResponseRuns(); @@ -151,7 +151,7 @@ public class ConditionalTest implements WithAssertions { public void whereTrueAndNotTrueThenOtherwiseRuns() { //when Condition.where(true) - .andNot(() -> true) + .and(() -> true).not() .then(thenResponse) .otherwise(otherwiseResponse); //then @@ -162,7 +162,7 @@ public class ConditionalTest implements WithAssertions { public void whereFalseOrNotFalseThenRuns() { //when Condition.where(false) - .orNot(() -> false) + .or(() -> false).not() .then(thenResponse); //then assertThatTheThenResponseRuns(); @@ -172,7 +172,7 @@ public class ConditionalTest implements WithAssertions { public void whereFalseOrNotTrueThenOtherwiseRuns() { //when Condition.where(false) - .orNot(() -> true) + .or(() -> true).not() .then(thenResponse) .otherwise(otherwiseResponse); //then diff --git a/src/test/java/net/kemitix/conditional/ValueTest.java b/src/test/java/net/kemitix/conditional/ValueTest.java index d32843d..5044ca4 100644 --- a/src/test/java/net/kemitix/conditional/ValueTest.java +++ b/src/test/java/net/kemitix/conditional/ValueTest.java @@ -53,7 +53,7 @@ public class ValueTest implements WithAssertions { @Test public void valueWhereClauseIsTrue() { //when - val result = Value.where(TRUE_CONDITION).then(() -> TRUE) + final val result = Value.where(TRUE_CONDITION).then(() -> TRUE) .otherwise(() -> FALSE); //then assertThat(result).isEqualTo(TRUE); @@ -62,7 +62,7 @@ public class ValueTest implements WithAssertions { @Test public void valueWhereClauseIsFalse() { //when - val result = Value.where(FALSE_CONDITION).then(() -> TRUE) + final val result = Value.where(FALSE_CONDITION).then(() -> TRUE) .otherwise(() -> FALSE); //then assertThat(result).isEqualTo(FALSE); @@ -71,7 +71,7 @@ public class ValueTest implements WithAssertions { @Test public void valueWhereTrueAndTrueIsTrue() { //when - val result = Value.where(TRUE_CONDITION).and(() -> true) + final val result = Value.where(TRUE_CONDITION).and(() -> true) .then(() -> TRUE) .otherwise(() -> FALSE); //then @@ -81,7 +81,7 @@ public class ValueTest implements WithAssertions { @Test public void valueWhereTrueAndFalseIsFalse() { //when - val result = Value.where(TRUE_CONDITION).and(() -> false) + final val result = Value.where(TRUE_CONDITION).and(() -> false) .then(() -> TRUE) .otherwise(() -> FALSE); //then @@ -91,7 +91,7 @@ public class ValueTest implements WithAssertions { @Test public void valueWhereFalseAndTrueIsFalse() { //when - val result = Value.where(FALSE_CONDITION).and(() -> true) + final val result = Value.where(FALSE_CONDITION).and(() -> true) .then(() -> TRUE) .otherwise(() -> FALSE); //then @@ -101,7 +101,7 @@ public class ValueTest implements WithAssertions { @Test public void valueWhereFalseAndFalseIsFalse() { //when - val result = Value.where(FALSE_CONDITION).and(() -> false) + final val result = Value.where(FALSE_CONDITION).and(() -> false) .then(() -> TRUE) .otherwise(() -> FALSE); //then @@ -111,7 +111,7 @@ public class ValueTest implements WithAssertions { @Test public void valueWhereTrueOrTrueIsTrue() { //when - val result = Value.where(TRUE_CONDITION).or(() -> true) + final val result = Value.where(TRUE_CONDITION).or(() -> true) .then(() -> TRUE) .otherwise(() -> FALSE); //then @@ -121,7 +121,7 @@ public class ValueTest implements WithAssertions { @Test public void valueWhereTrueOrFalseIsTrue() { //when - val result = Value.where(TRUE_CONDITION).or(() -> false) + final val result = Value.where(TRUE_CONDITION).or(() -> false) .then(() -> TRUE) .otherwise(() -> FALSE); //then @@ -131,7 +131,7 @@ public class ValueTest implements WithAssertions { @Test public void valueWhereFalseOrTrueIsTrue() { //when - val result = Value.where(FALSE_CONDITION).or(() -> true) + final val result = Value.where(FALSE_CONDITION).or(() -> true) .then(() -> TRUE) .otherwise(() -> FALSE); //then @@ -141,7 +141,7 @@ public class ValueTest implements WithAssertions { @Test public void valueWhereFalseOrFalseIsFalse() { //when - val result = Value.where(FALSE_CONDITION).or(() -> false) + final val result = Value.where(FALSE_CONDITION).or(() -> false) .then(() -> TRUE) .otherwise(() -> FALSE); //then @@ -151,7 +151,7 @@ public class ValueTest implements WithAssertions { @Test public void valueWhereNotTrueIsFalse() { //when - val result = Value.whereNot(true).then(() -> TRUE) + final val result = Value.where(true).not().then(() -> TRUE) .otherwise(() -> FALSE); //then assertThat(result).isEqualTo(FALSE); @@ -160,7 +160,7 @@ public class ValueTest implements WithAssertions { @Test public void deprecatedValueWhereNotFalseIsTrue() { //when - val result = Value.whereNot(false).then(() -> TRUE) + final val result = Value.where(false).not().then(() -> TRUE) .otherwise(() -> FALSE); //then assertThat(result).isEqualTo(TRUE); @@ -169,7 +169,7 @@ public class ValueTest implements WithAssertions { @Test public void valueWhereNotFalseIsTrue() { //when - val result = Value.where(false).not().then(() -> TRUE) + final val result = Value.where(false).not().then(() -> TRUE) .otherwise(() -> FALSE); //then assertThat(result).isEqualTo(TRUE); @@ -178,7 +178,7 @@ public class ValueTest implements WithAssertions { @Test public void valueWhereTrueAndNotTrueIsFalse() { //when - val result = Value.where(TRUE_CONDITION).andNot(() -> true) + final val result = Value.where(TRUE_CONDITION).and(() -> true).not() .then(() -> TRUE) .otherwise(() -> FALSE); //then @@ -188,7 +188,7 @@ public class ValueTest implements WithAssertions { @Test public void valueWhereTrueAndNotFalseIsTrue() { //when - val result = Value.where(TRUE_CONDITION).andNot(() -> false) + final val result = Value.where(TRUE_CONDITION).and(() -> false).not() .then(() -> TRUE) .otherwise(() -> FALSE); //then @@ -198,7 +198,7 @@ public class ValueTest implements WithAssertions { @Test public void valueWhereFalseAndNotTrueIsFalse() { //when - val result = Value.where(FALSE_CONDITION).and(() -> true) + final val result = Value.where(FALSE_CONDITION).and(() -> true) .then(() -> TRUE) .otherwise(() -> FALSE); //then @@ -208,7 +208,7 @@ public class ValueTest implements WithAssertions { @Test public void valueWhereFalseAndNotFalseIsFalse() { //when - val result = Value.where(FALSE_CONDITION).and(() -> false) + final val result = Value.where(FALSE_CONDITION).and(() -> false) .then(() -> TRUE) .otherwise(() -> FALSE); //then @@ -218,7 +218,7 @@ public class ValueTest implements WithAssertions { @Test public void valueWhereTrueOrNotTrueIsTrue() { //when - val result = Value.where(true).orNot(() -> true) + final val result = Value.where(true).orNot(() -> true) .then(() -> TRUE) .otherwise(() -> FALSE); //then @@ -228,7 +228,7 @@ public class ValueTest implements WithAssertions { @Test public void valueWhereTrueOrNotFalseIsTrue() { //when - val result = Value.where(TRUE_CONDITION).orNot(() -> false) + final val result = Value.where(TRUE_CONDITION).orNot(() -> false) .then(() -> TRUE) .otherwise(() -> FALSE); //then @@ -238,7 +238,7 @@ public class ValueTest implements WithAssertions { @Test public void deprecatedValueWhereFalseOrNotTrueIsFalse() { //when - val result = Value.where(FALSE_CONDITION).orNot(() -> true) + final val result = Value.where(FALSE_CONDITION).orNot(() -> true) .then(() -> TRUE) .otherwise(() -> FALSE); //then @@ -248,7 +248,7 @@ public class ValueTest implements WithAssertions { @Test public void valueWhereFalseOrNotTrueIsFalse() { //when - val result = Value.where(FALSE_CONDITION).or(() -> true).not() + final val result = Value.where(FALSE_CONDITION).or(() -> true).not() .then(() -> TRUE) .otherwise(() -> FALSE); //then @@ -258,7 +258,7 @@ public class ValueTest implements WithAssertions { @Test public void valueWhereFalseOrNotFalseIsTrue() { //when - val result = Value.where(false).orNot(() -> false) + final val result = Value.where(false).orNot(() -> false) .then(() -> TRUE) .otherwise(() -> FALSE); //then @@ -308,4 +308,13 @@ public class ValueTest implements WithAssertions { assertThat(result).isEmpty(); assertThat(atomicInteger).hasValue(0); } + + @Test + public void deprecatedAndNot() { + //when + final String result = Value.where(TRUE_CONDITION).andNot(() -> false) + .then(() -> TRUE).otherwise(() -> FALSE); + //then + assertThat(result).isSameAs(TRUE); + } } From 13003708e148e5d4d00a8530d16842e8314237ad Mon Sep 17 00:00:00 2001 From: Paul Campbell Date: Sat, 25 Aug 2018 15:26:25 +0100 Subject: [PATCH 3/4] pom: Remove redundant properties --- pom.xml | 6 ------ 1 file changed, 6 deletions(-) diff --git a/pom.xml b/pom.xml index 2bde308..8fb56af 100644 --- a/pom.xml +++ b/pom.xml @@ -15,12 +15,6 @@ 4.1.1 - 5-complexity - 1 - 1 - 0 - 100 - 100 4.12 3.11.0 4.3.0 From 94c68f10bdff18f7af31bb3a2946dd09a88b0044 Mon Sep 17 00:00:00 2001 From: Paul Campbell Date: Sat, 25 Aug 2018 15:32:15 +0100 Subject: [PATCH 4/4] Update CHANGELOG --- CHANGELOG | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/CHANGELOG b/CHANGELOG index 9e0efab..f2be9d9 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -4,7 +4,17 @@ CHANGELOG 0.7.0 ----- -* Deprecate `Value.andNot(Supplier)` +* Deprecate Value.andNot(Supplier) +* pom: Remove redundant properties +* Remove deprecated methods +* pom: rearrange entries +* Bump assertj-core from 3.10.0 to 3.11.0 +* Bump lombok from 1.18.0 to 1.18.2 +* Bump tiles-maven-plugin from 2.11 to 2.12 +* README: update Value examples +* README: update Condition examples +* Value: cleanup deprecated whereNot() +* README: convert to orgmode format 0.6.0 -----