From a4cab835ed7913db9adc26e3f6a83baa02e6521a Mon Sep 17 00:00:00 2001 From: trydofor Date: Sun, 18 Feb 2024 12:39:40 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=F0=9F=9A=80=20bump=202.7.1=20and=20alt=20d?= =?UTF-8?q?eploy=20#25?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/release.yml | 50 ++++++++++++++++++++++++++++------- pom.xml | 20 ++++++++++++-- 2 files changed, 59 insertions(+), 11 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index a6a1bae..c6b5c43 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -30,7 +30,12 @@ on: type: boolean required: false deployOssrh: - description: 'deploy to ossrh?' + description: 'deploy to oss-repo?' + default: true + type: boolean + required: false + deployAltrh: + description: 'deploy to alt-repo?' default: true type: boolean required: false @@ -101,8 +106,12 @@ jobs: echo "MVN_COVERAGE=$_cov" >> "$GITHUB_OUTPUT" _drh=${{ inputs.deployOssrh || github.event_name == 'release' }} - echo "- MVN_DEPLOYRH=$_drh" >> "$GITHUB_STEP_SUMMARY" - echo "MVN_DEPLOYRH=$_drh" >> "$GITHUB_OUTPUT" + echo "- MVN_DEPLOY_OSSRH=$_drh" >> "$GITHUB_STEP_SUMMARY" + echo "MVN_DEPLOY_OSSRH=$_drh" >> "$GITHUB_OUTPUT" + + _drp=${{ ( inputs.deployAltrh || github.event_name == 'release' ) && secrets.MVN_ALT_USER != '' }} + echo "- MVN_DEPLOY_ALTRH=$_drp" >> "$GITHUB_STEP_SUMMARY" + echo "MVN_DEPLOY_ALTRH=$_drp" >> "$GITHUB_OUTPUT" _qod=${{ inputs.applyQodanaScan || 'false' }} echo "- QODANA_SCAN=$_qod" >> "$GITHUB_STEP_SUMMARY" @@ -125,6 +134,11 @@ jobs: ${MVN_OSS_USER} ${MVN_OSS_PASS} + + altrh + ${MVN_ALT_USER} + ${MVN_ALT_PASS} + EOF @@ -151,23 +165,41 @@ jobs: ## import gpp private key - name: Import GPG key - if: steps.settings.outputs.MVN_DEPLOYRH == 'true' + if: steps.settings.outputs.MVN_DEPLOY_OSSRH == 'true' || steps.settings.outputs.MVN_DEPLOY_ALTRH == 'true' uses: crazy-max/ghaction-import-gpg@v6 with: gpg_private_key: ${{ secrets.MVN_GPG_SKEY }} passphrase: ${{ secrets.MVN_GPG_PASS }} - ## maven deploy - - name: Deploy ${{ steps.settings.outputs.WINGS_VERSION }} ${{ steps.settings.outputs.GIT_BRANCH }} - if: steps.settings.outputs.MVN_DEPLOYRH == 'true' + ## maven deploy ossrh + - name: Deploy OSS ${{ steps.settings.outputs.WINGS_VERSION }} ${{ steps.settings.outputs.GIT_BRANCH }} + if: steps.settings.outputs.MVN_DEPLOY_OSSRH == 'true' run: > mvn - -P 'ossrh' + -P 'deploy,ossrh' ${{ steps.settings.outputs.MVN_REVISION }} -Dgpg.passphrase=${MVN_GPG_PASS} - clean deploy + deploy env: JAVA_HOME: ${{ steps.settings.outputs.JAVA_HOME }} + MVN_GPG_PASS: ${{ secrets.MVN_GPG_PASS }} MVN_OSS_USER: ${{ secrets.MVN_OSS_USER }} MVN_OSS_PASS: ${{ secrets.MVN_OSS_PASS }} + + ## maven deploy altrh + - name: Deploy ALT ${{ steps.settings.outputs.WINGS_VERSION }} ${{ steps.settings.outputs.GIT_BRANCH }} + if: steps.settings.outputs.MVN_DEPLOY_ALTRH == 'true' + run: > + mvn + -P 'deploy,altrh' + ${{ steps.settings.outputs.MVN_REVISION }} + -Dgpg.passphrase=${MVN_GPG_PASS} + deploy + env: + JAVA_HOME: ${{ steps.settings.outputs.JAVA_HOME }} MVN_GPG_PASS: ${{ secrets.MVN_GPG_PASS }} + ## export MVN_ALT_REPO=https://packages.trydofor.com/maven/repository/devops/ + MVN_ALT_USER: ${{ secrets.MVN_ALT_USER }} + MVN_ALT_PASS: ${{ secrets.MVN_ALT_PASS }} + MVN_ALT_REPO: ${{ secrets.MVN_ALT_REPO }} + MVN_ALT_SNAP: ${{ secrets.MVN_ALT_SNAP }} diff --git a/pom.xml b/pom.xml index 3d895be..0c910ac 100644 --- a/pom.xml +++ b/pom.xml @@ -60,7 +60,7 @@ - 2.7.0-SNAPSHOT + 2.7.1-SNAPSHOT UTF-8 UTF-8 1.8 @@ -336,7 +336,7 @@ - ossrh + deploy true @@ -359,6 +359,13 @@ + + + + + ossrh + + org.sonatype.plugins nexus-staging-maven-plugin @@ -384,5 +391,14 @@ + + altrh + + + altrh::${MVN_ALT_REPO} + + altrh::${MVN_ALT_SNAP} + + From 12364ff38f46e04a4f2558b17bbf8e81c3291f9d Mon Sep 17 00:00:00 2001 From: trydofor Date: Wed, 21 Feb 2024 10:55:54 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=F0=9F=90=9B=20AssertState.notNull=20no=20s?= =?UTF-8?q?tacktrace=20#26?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pro/fessional/mirana/best/AssertArgs.java | 34 +++++++++---------- .../fessional/mirana/best/AssertMessage.java | 34 +++++++++---------- .../fessional/mirana/best/AssertState.java | 34 +++++++++---------- .../fessional/mirana/i18n/I18nEnumTest.java | 30 ++++++++++++++++ 4 files changed, 81 insertions(+), 51 deletions(-) diff --git a/src/main/java/pro/fessional/mirana/best/AssertArgs.java b/src/main/java/pro/fessional/mirana/best/AssertArgs.java index 1012789..ae4bf93 100644 --- a/src/main/java/pro/fessional/mirana/best/AssertArgs.java +++ b/src/main/java/pro/fessional/mirana/best/AssertArgs.java @@ -30,7 +30,7 @@ public static void isTrue(boolean b, @NotNull String msg, Object... args) { @Contract("false, _, _ -> fail") public static void isTrue(boolean b, @NotNull CodeEnum code, Object... args) { - if (!b) throw new BadArgsException(false, code, args); + if (!b) throw new BadArgsException(code, args); } // @@ -46,7 +46,7 @@ public static void isFalse(boolean b, @NotNull String msg, Object... args) { @Contract("true, _, _ -> fail") public static void isFalse(boolean b, @NotNull CodeEnum code, Object... args) { - if (b) throw new BadArgsException(false, code, args); + if (b) throw new BadArgsException(code, args); } // @@ -62,7 +62,7 @@ public static void isNull(@Nullable Object b, @NotNull String msg, Object... arg @Contract("!null, _, _ -> fail") public static void isNull(@Nullable Object b, @NotNull CodeEnum code, Object... args) { - if (b != null) throw new BadArgsException(false, code, args); + if (b != null) throw new BadArgsException(code, args); } // @@ -78,7 +78,7 @@ public static void notNull(@Nullable Object b, @NotNull String msg, Object... ar @Contract("null, _, _ -> fail") public static void notNull(@Nullable Object b, @NotNull CodeEnum code, Object... args) { - if (b == null) throw new BadArgsException(false, code, args); + if (b == null) throw new BadArgsException(code, args); } // //// @@ -91,7 +91,7 @@ public static void isEmpty(@Nullable CharSequence c, @NotNull String msg, Object } public static void isEmpty(@Nullable CharSequence c, @NotNull CodeEnum code, Object... args) { - if (c != null && c.length() > 0) throw new BadArgsException(false, code, args); + if (c != null && c.length() > 0) throw new BadArgsException(code, args); } // @@ -107,7 +107,7 @@ public static void notEmpty(@Nullable CharSequence c, @NotNull String msg, Objec @Contract("null, _, _ -> fail") public static void notEmpty(@Nullable CharSequence c, @NotNull CodeEnum code, Object... args) { - if (c == null || c.length() == 0) throw new BadArgsException(false, code, args); + if (c == null || c.length() == 0) throw new BadArgsException(code, args); } // //// @@ -120,7 +120,7 @@ public static void isEmpty(@Nullable Collection c, @NotNull String msg, Objec } public static void isEmpty(@Nullable Collection c, @NotNull CodeEnum code, Object... args) { - if (c != null && !c.isEmpty()) throw new BadArgsException(false, code, args); + if (c != null && !c.isEmpty()) throw new BadArgsException(code, args); } // @@ -136,7 +136,7 @@ public static void notEmpty(@Nullable Collection c, @NotNull String msg, Obje @Contract("null, _, _ -> fail") public static void notEmpty(@Nullable Collection c, @NotNull CodeEnum code, Object... args) { - if (c == null || c.isEmpty()) throw new BadArgsException(false, code, args); + if (c == null || c.isEmpty()) throw new BadArgsException(code, args); } // //// @@ -149,7 +149,7 @@ public static void isEmpty(@Nullable Map c, @NotNull String msg, Object... } public static void isEmpty(@Nullable Map c, @NotNull CodeEnum code, Object... args) { - if (c != null && !c.isEmpty()) throw new BadArgsException(false, code, args); + if (c != null && !c.isEmpty()) throw new BadArgsException(code, args); } // @@ -165,7 +165,7 @@ public static void notEmpty(@Nullable Map c, @NotNull String msg, Object.. @Contract("null, _, _ -> fail") public static void notEmpty(@Nullable Map c, @NotNull CodeEnum code, Object... args) { - if (c == null || c.isEmpty()) throw new BadArgsException(false, code, args); + if (c == null || c.isEmpty()) throw new BadArgsException(code, args); } // //// @@ -178,7 +178,7 @@ public static void isEmpty(@Nullable Object[] c, @NotNull String msg, Object... } public static void isEmpty(@Nullable Object[] c, @NotNull CodeEnum code, Object... args) { - if (c != null && c.length > 0) throw new BadArgsException(false, code, args); + if (c != null && c.length > 0) throw new BadArgsException(code, args); } // @@ -194,7 +194,7 @@ public static void notEmpty(@Nullable Object[] c, @NotNull String msg, Object... @Contract("null, _, _ -> fail") public static void notEmpty(@Nullable Object[] c, @NotNull CodeEnum code, Object... args) { - if (c == null || c.length == 0) throw new BadArgsException(false, code, args); + if (c == null || c.length == 0) throw new BadArgsException(code, args); } // @@ -210,7 +210,7 @@ public static > void aEqb(@Nullable T a, @Nullable T b, public static > void aEqb(@Nullable T a, @Nullable T b, @NotNull CodeEnum code, Object... args) { if (a == null && b == null) return; - if (a == null || !a.equals(b)) throw new BadArgsException(false, code, args); + if (a == null || !a.equals(b)) throw new BadArgsException(code, args); } // @@ -226,7 +226,7 @@ public static > void aGeb(@Nullable T a, @Nullable T b, public static > void aGeb(@Nullable T a, @Nullable T b, @NotNull CodeEnum code, Object... args) { if (a == null && b == null) return; - if (a == null || b == null || a.compareTo(b) < 0) throw new BadArgsException(false, code, args); + if (a == null || b == null || a.compareTo(b) < 0) throw new BadArgsException(code, args); } // @@ -239,7 +239,7 @@ public static > void aGtb(@Nullable T a, @Nullable T b, } public static > void aGtb(@Nullable T a, @Nullable T b, @NotNull CodeEnum code, Object... args) { - if (a == null || b == null || a.compareTo(b) <= 0) throw new BadArgsException(false, code, args); + if (a == null || b == null || a.compareTo(b) <= 0) throw new BadArgsException(code, args); } // @@ -255,7 +255,7 @@ public static > void aLeb(@Nullable T a, @Nullable T b, public static > void aLeb(@Nullable T a, @Nullable T b, @NotNull CodeEnum code, Object... args) { if (a == null && b == null) return; - if (a == null || b == null || a.compareTo(b) > 0) throw new BadArgsException(false, code, args); + if (a == null || b == null || a.compareTo(b) > 0) throw new BadArgsException(code, args); } // @@ -268,6 +268,6 @@ public static > void aLtb(@Nullable T a, @Nullable T b, } public static > void aLtb(@Nullable T a, @Nullable T b, @NotNull CodeEnum code, Object... args) { - if (a == null || b == null || a.compareTo(b) >= 0) throw new BadArgsException(false, code, args); + if (a == null || b == null || a.compareTo(b) >= 0) throw new BadArgsException(code, args); } } diff --git a/src/main/java/pro/fessional/mirana/best/AssertMessage.java b/src/main/java/pro/fessional/mirana/best/AssertMessage.java index 0d60a6b..bf1dd90 100644 --- a/src/main/java/pro/fessional/mirana/best/AssertMessage.java +++ b/src/main/java/pro/fessional/mirana/best/AssertMessage.java @@ -30,7 +30,7 @@ public static void isTrue(boolean b, @NotNull String msg, Object... args) { @Contract("false, _, _ -> fail") public static void isTrue(boolean b, @NotNull CodeEnum code, Object... args) { - if (!b) throw new MessageException(false, code, args); + if (!b) throw new MessageException(code, args); } // @@ -46,7 +46,7 @@ public static void isFalse(boolean b, @NotNull String msg, Object... args) { @Contract("true, _, _ -> fail") public static void isFalse(boolean b, @NotNull CodeEnum code, Object... args) { - if (b) throw new MessageException(false, code, args); + if (b) throw new MessageException(code, args); } // //// @@ -62,7 +62,7 @@ public static void isNull(@Nullable Object b, @NotNull String msg, Object... arg @Contract("!null, _, _ -> fail") public static void isNull(@Nullable Object b, @NotNull CodeEnum code, Object... args) { - if (b != null) throw new MessageException(false, code, args); + if (b != null) throw new MessageException(code, args); } // @@ -78,7 +78,7 @@ public static void notNull(@Nullable Object b, @NotNull String msg, Object... ar @Contract("null, _, _ -> fail") public static void notNull(@Nullable Object b, @NotNull CodeEnum code, Object... args) { - if (b == null) throw new MessageException(false, code, args); + if (b == null) throw new MessageException(code, args); } // //// @@ -91,7 +91,7 @@ public static void isEmpty(@Nullable CharSequence c, @NotNull String msg, Object } public static void isEmpty(@Nullable CharSequence c, @NotNull CodeEnum code, Object... args) { - if (c != null && c.length() > 0) throw new MessageException(false, code, args); + if (c != null && c.length() > 0) throw new MessageException(code, args); } // @@ -107,7 +107,7 @@ public static void notEmpty(@Nullable CharSequence c, @NotNull String msg, Objec @Contract("null, _, _ -> fail") public static void notEmpty(@Nullable CharSequence c, @NotNull CodeEnum code, Object... args) { - if (c == null || c.length() == 0) throw new MessageException(false, code, args); + if (c == null || c.length() == 0) throw new MessageException(code, args); } // //// @@ -120,7 +120,7 @@ public static void isEmpty(@Nullable Collection c, @NotNull String msg, Objec } public static void isEmpty(@Nullable Collection c, @NotNull CodeEnum code, Object... args) { - if (c != null && !c.isEmpty()) throw new MessageException(false, code, args); + if (c != null && !c.isEmpty()) throw new MessageException(code, args); } // @@ -136,7 +136,7 @@ public static void notEmpty(@Nullable Collection c, @NotNull String msg, Obje @Contract("null, _, _ -> fail") public static void notEmpty(@Nullable Collection c, @NotNull CodeEnum code, Object... args) { - if (c == null || c.isEmpty()) throw new MessageException(false, code, args); + if (c == null || c.isEmpty()) throw new MessageException(code, args); } // //// @@ -149,7 +149,7 @@ public static void isEmpty(@Nullable Map c, @NotNull String msg, Object... } public static void isEmpty(@Nullable Map c, @NotNull CodeEnum code, Object... args) { - if (c != null && !c.isEmpty()) throw new MessageException(false, code, args); + if (c != null && !c.isEmpty()) throw new MessageException(code, args); } // @@ -165,7 +165,7 @@ public static void notEmpty(@Nullable Map c, @NotNull String msg, Object.. @Contract("null, _, _ -> fail") public static void notEmpty(@Nullable Map c, @NotNull CodeEnum code, Object... args) { - if (c == null || c.isEmpty()) throw new MessageException(false, code, args); + if (c == null || c.isEmpty()) throw new MessageException(code, args); } // //// @@ -178,7 +178,7 @@ public static void isEmpty(@Nullable Object[] c, @NotNull String msg, Object... } public static void isEmpty(@Nullable Object[] c, @NotNull CodeEnum code, Object... args) { - if (c != null && c.length > 0) throw new MessageException(false, code, args); + if (c != null && c.length > 0) throw new MessageException(code, args); } // @@ -194,7 +194,7 @@ public static void notEmpty(@Nullable Object[] c, @NotNull String msg, Object... @Contract("null, _, _ -> fail") public static void notEmpty(@Nullable Object[] c, @NotNull CodeEnum code, Object... args) { - if (c == null || c.length == 0) throw new MessageException(false, code, args); + if (c == null || c.length == 0) throw new MessageException(code, args); } @@ -211,7 +211,7 @@ public static > void aEqb(@Nullable T a, @Nullable T b, public static > void aEqb(@Nullable T a, @Nullable T b, @NotNull CodeEnum code, Object... args) { if (a == null && b == null) return; - if (a == null || !a.equals(b)) throw new MessageException(false, code, args); + if (a == null || !a.equals(b)) throw new MessageException(code, args); } // @@ -227,7 +227,7 @@ public static > void aGeb(@Nullable T a, @Nullable T b, public static > void aGeb(@Nullable T a, @Nullable T b, @NotNull CodeEnum code, Object... args) { if (a == null && b == null) return; - if (a == null || b == null || a.compareTo(b) < 0) throw new MessageException(false, code, args); + if (a == null || b == null || a.compareTo(b) < 0) throw new MessageException(code, args); } // @@ -240,7 +240,7 @@ public static > void aGtb(@Nullable T a, @Nullable T b, } public static > void aGtb(@Nullable T a, @Nullable T b, @NotNull CodeEnum code, Object... args) { - if (a == null || b == null || a.compareTo(b) <= 0) throw new MessageException(false, code, args); + if (a == null || b == null || a.compareTo(b) <= 0) throw new MessageException(code, args); } // @@ -256,7 +256,7 @@ public static > void aLeb(@Nullable T a, @Nullable T b, public static > void aLeb(@Nullable T a, @Nullable T b, @NotNull CodeEnum code, Object... args) { if (a == null && b == null) return; - if (a == null || b == null || a.compareTo(b) > 0) throw new MessageException(false, code, args); + if (a == null || b == null || a.compareTo(b) > 0) throw new MessageException(code, args); } // @@ -269,6 +269,6 @@ public static > void aLtb(@Nullable T a, @Nullable T b, } public static > void aLtb(@Nullable T a, @Nullable T b, @NotNull CodeEnum code, Object... args) { - if (a == null || b == null || a.compareTo(b) >= 0) throw new MessageException(false, code, args); + if (a == null || b == null || a.compareTo(b) >= 0) throw new MessageException(code, args); } } diff --git a/src/main/java/pro/fessional/mirana/best/AssertState.java b/src/main/java/pro/fessional/mirana/best/AssertState.java index 0d71524..40f59fa 100644 --- a/src/main/java/pro/fessional/mirana/best/AssertState.java +++ b/src/main/java/pro/fessional/mirana/best/AssertState.java @@ -30,7 +30,7 @@ public static void isTrue(boolean b, @NotNull String msg, Object... args) { @Contract("false, _, _ -> fail") public static void isTrue(boolean b, @NotNull CodeEnum code, Object... args) { - if (!b) throw new BadStateException(false, code, args); + if (!b) throw new BadStateException(code, args); } // @@ -46,7 +46,7 @@ public static void isFalse(boolean b, @NotNull String msg, Object... args) { @Contract("true, _, _ -> fail") public static void isFalse(boolean b, @NotNull CodeEnum code, Object... args) { - if (b) throw new BadStateException(false, code, args); + if (b) throw new BadStateException(code, args); } // //// @@ -62,7 +62,7 @@ public static void isNull(@Nullable Object b, @NotNull String msg, Object... arg @Contract("!null, _, _ -> fail") public static void isNull(@Nullable Object b, @NotNull CodeEnum code, Object... args) { - if (b != null) throw new BadStateException(false, code, args); + if (b != null) throw new BadStateException(code, args); } // @@ -78,7 +78,7 @@ public static void notNull(@Nullable Object b, @NotNull String msg, Object... ar @Contract("null, _, _ -> fail") public static void notNull(@Nullable Object b, @NotNull CodeEnum code, Object... args) { - if (b == null) throw new BadStateException(false, code, args); + if (b == null) throw new BadStateException(code, args); } // //// @@ -91,7 +91,7 @@ public static void isEmpty(@Nullable CharSequence c, @NotNull String msg, Object } public static void isEmpty(@Nullable CharSequence c, @NotNull CodeEnum code, Object... args) { - if (c != null && c.length() > 0) throw new BadStateException(false, code, args); + if (c != null && c.length() > 0) throw new BadStateException(code, args); } // @@ -107,7 +107,7 @@ public static void notEmpty(@Nullable CharSequence c, @NotNull String msg, Objec @Contract("null, _, _ -> fail") public static void notEmpty(@Nullable CharSequence c, @NotNull CodeEnum code, Object... args) { - if (c == null || c.length() == 0) throw new BadStateException(false, code, args); + if (c == null || c.length() == 0) throw new BadStateException(code, args); } // //// @@ -120,7 +120,7 @@ public static void isEmpty(@Nullable Collection c, @NotNull String msg, Objec } public static void isEmpty(@Nullable Collection c, @NotNull CodeEnum code, Object... args) { - if (c != null && !c.isEmpty()) throw new BadStateException(false, code, args); + if (c != null && !c.isEmpty()) throw new BadStateException(code, args); } // @@ -136,7 +136,7 @@ public static void notEmpty(@Nullable Collection c, @NotNull String msg, Obje @Contract("null, _, _ -> fail") public static void notEmpty(@Nullable Collection c, @NotNull CodeEnum code, Object... args) { - if (c == null || c.isEmpty()) throw new BadStateException(false, code, args); + if (c == null || c.isEmpty()) throw new BadStateException(code, args); } // //// @@ -149,7 +149,7 @@ public static void isEmpty(@Nullable Map c, @NotNull String msg, Object... } public static void isEmpty(@Nullable Map c, @NotNull CodeEnum code, Object... args) { - if (c != null && !c.isEmpty()) throw new BadStateException(false, code, args); + if (c != null && !c.isEmpty()) throw new BadStateException(code, args); } // @@ -165,7 +165,7 @@ public static void notEmpty(@Nullable Map c, @NotNull String msg, Object.. @Contract("null, _, _ -> fail") public static void notEmpty(@Nullable Map c, @NotNull CodeEnum code, Object... args) { - if (c == null || c.isEmpty()) throw new BadStateException(false, code, args); + if (c == null || c.isEmpty()) throw new BadStateException(code, args); } // //// @@ -178,7 +178,7 @@ public static void isEmpty(@Nullable Object[] c, @NotNull String msg, Object... } public static void isEmpty(@Nullable Object[] c, @NotNull CodeEnum code, Object... args) { - if (c != null && c.length > 0) throw new BadStateException(false, code, args); + if (c != null && c.length > 0) throw new BadStateException(code, args); } // @@ -194,7 +194,7 @@ public static void notEmpty(@Nullable Object[] c, @NotNull String msg, Object... @Contract("null, _, _ -> fail") public static void notEmpty(@Nullable Object[] c, @NotNull CodeEnum code, Object... args) { - if (c == null || c.length == 0) throw new BadStateException(false, code, args); + if (c == null || c.length == 0) throw new BadStateException(code, args); } @@ -211,7 +211,7 @@ public static > void aEqb(@Nullable T a, @Nullable T b, public static > void aEqb(@Nullable T a, @Nullable T b, @NotNull CodeEnum code, Object... args) { if (a == null && b == null) return; - if (a == null || !a.equals(b)) throw new BadStateException(false, code, args); + if (a == null || !a.equals(b)) throw new BadStateException(code, args); } // @@ -227,7 +227,7 @@ public static > void aGeb(@Nullable T a, @Nullable T b, public static > void aGeb(@Nullable T a, @Nullable T b, @NotNull CodeEnum code, Object... args) { if (a == null && b == null) return; - if (a == null || b == null || a.compareTo(b) < 0) throw new BadStateException(false, code, args); + if (a == null || b == null || a.compareTo(b) < 0) throw new BadStateException(code, args); } // @@ -240,7 +240,7 @@ public static > void aGtb(@Nullable T a, @Nullable T b, } public static > void aGtb(@Nullable T a, @Nullable T b, @NotNull CodeEnum code, Object... args) { - if (a == null || b == null || a.compareTo(b) <= 0) throw new BadStateException(false, code, args); + if (a == null || b == null || a.compareTo(b) <= 0) throw new BadStateException(code, args); } // @@ -256,7 +256,7 @@ public static > void aLeb(@Nullable T a, @Nullable T b, public static > void aLeb(@Nullable T a, @Nullable T b, @NotNull CodeEnum code, Object... args) { if (a == null && b == null) return; - if (a == null || b == null || a.compareTo(b) > 0) throw new BadStateException(false, code, args); + if (a == null || b == null || a.compareTo(b) > 0) throw new BadStateException(code, args); } // @@ -269,6 +269,6 @@ public static > void aLtb(@Nullable T a, @Nullable T b, } public static > void aLtb(@Nullable T a, @Nullable T b, @NotNull CodeEnum code, Object... args) { - if (a == null || b == null || a.compareTo(b) >= 0) throw new BadStateException(false, code, args); + if (a == null || b == null || a.compareTo(b) >= 0) throw new BadStateException(code, args); } } diff --git a/src/test/java/pro/fessional/mirana/i18n/I18nEnumTest.java b/src/test/java/pro/fessional/mirana/i18n/I18nEnumTest.java index eb9bfb3..11b9505 100644 --- a/src/test/java/pro/fessional/mirana/i18n/I18nEnumTest.java +++ b/src/test/java/pro/fessional/mirana/i18n/I18nEnumTest.java @@ -2,6 +2,8 @@ import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; +import pro.fessional.mirana.best.AssertState; +import pro.fessional.mirana.pain.CodeException; /** * @author trydofor @@ -30,4 +32,32 @@ void testStand() { Assertions.assertEquals("pro.fessional.mirana.i18n.TestEnum", ti.getHint()); Assertions.assertEquals("pro.fessional.mirana.i18n.TestEnum.Ti11", ti.getI18nCode()); } + + @Test + void tweakStack() { + try { + AssertState.notNull(null, Ti11.LGD, ""); + Assertions.fail(); + } + catch (Exception e) { + StackTraceElement[] st = e.getStackTrace(); + Assertions.assertEquals(0, st.length); + } + finally { + CodeException.TweakStack.resetGlobal(); + } + + try { + CodeException.TweakStack.tweakGlobal(true); + AssertState.notNull(null, Ti11.LGD, ""); + Assertions.fail(); + } + catch (Exception e) { + StackTraceElement[] st = e.getStackTrace(); + Assertions.assertTrue(st.length > 0); + } + finally { + CodeException.TweakStack.resetGlobal(); + } + } }