From 55027d91efa07a7c03868ea7c0afd77f81b8b9b9 Mon Sep 17 00:00:00 2001
From: ZhouXY108
Date: Fri, 10 Jan 2025 17:39:41 +0800
Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=A4=9A=E7=B1=BB=E5=9E=8B?=
=?UTF-8?q?=E5=BC=82=E5=B8=B8=E7=9A=84=E7=BB=93=E6=9E=84?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
...tionType.java => MultiTypesException.java} | 81 ++++++++++++-------
.../exception/ParsingFailureException.java | 28 +++----
.../business/InvalidInputException.java | 34 ++++----
.../test/InvalidInputExceptionTests.java | 36 ++++-----
.../test/ParsingFailureExceptionTests.java | 42 +++++-----
5 files changed, 117 insertions(+), 104 deletions(-)
rename src/main/java/xyz/zhouxy/plusone/commons/exception/{ExceptionType.java => MultiTypesException.java} (55%)
diff --git a/src/main/java/xyz/zhouxy/plusone/commons/exception/ExceptionType.java b/src/main/java/xyz/zhouxy/plusone/commons/exception/MultiTypesException.java
similarity index 55%
rename from src/main/java/xyz/zhouxy/plusone/commons/exception/ExceptionType.java
rename to src/main/java/xyz/zhouxy/plusone/commons/exception/MultiTypesException.java
index f8ad83b..e97cec8 100644
--- a/src/main/java/xyz/zhouxy/plusone/commons/exception/ExceptionType.java
+++ b/src/main/java/xyz/zhouxy/plusone/commons/exception/MultiTypesException.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2024 the original author or authors.
+ * Copyright 2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -20,30 +20,45 @@ import javax.annotation.Nonnull;
import xyz.zhouxy.plusone.commons.base.IWithCode;
/**
- * 异常类型
+ * MultiTypesException
*
*
- * 异常在不同场景下被抛出,可以用不同的枚举值,表示不同的异常类型。
- * 该枚举实现本接口,用于基于不同类型创建异常。
+ * 异常在不同场景下被抛出,可以用不同的枚举值,表示不同的场景类型。
+ *
+ *
+ * 异常实现 {@link MultiTypesException} 的 {@link #getType} 方法,返回对应的场景类型。
+ *
+ *
+ * 表示场景类型的枚举实现 {@link ExceptionType},其中的工厂方法用于创建类型对象。
+ *
*
*
- * public final class LoginException extends RuntimeException {
+ * public final class LoginException
+ * extends RuntimeException
+ * implements MultiTypesException<LoginException, LoginException.Type> {
* private final Type type;
- * private LoginException(Type type, String message) {
+ * private LoginException(@Nonnull Type type, @Nonnull String message) {
* super(message);
* this.type = type;
* }
*
- * private LoginException(Type type, Throwable cause) {
+ * private LoginException(@Nonnull Type type, @Nonnull Throwable cause) {
* super(cause);
* this.type = type;
* }
*
- * private LoginException(Type type, String message, Throwable cause) {
+ * private LoginException(@Nonnull Type type,
+ * @Nonnull String message,
+ * @Nonnull Throwable cause) {
* super(message, cause);
* this.type = type;
* }
*
+ * @Override
+ * public @Nonnull Type getType() {
+ * return this.type;
+ * }
+ *
* // ...
*
* public enum Type implements ExceptionType {
@@ -60,43 +75,38 @@ import xyz.zhouxy.plusone.commons.base.IWithCode;
* @Nonnull
* private final String defaultMessage;
*
- * Type(String code, String defaultMessage) {
+ * Type(@Nonnull String code, @Nonnull String defaultMessage) {
* this.code = code;
* this.defaultMessage = defaultMessage;
* }
*
* @Override
- * @Nonnull
- * public String getCode() {
+ * public @Nonnull String getCode() {
* return code;
* }
*
* @Override
- * public String getDefaultMessage() {
+ * public @Nonnull String getDefaultMessage() {
* return defaultMessage;
* }
*
* @Override
- * @Nonnull
- * public LoginException create() {
+ * public @Nonnull LoginException create() {
* return new LoginException(this, this.defaultMessage);
* }
*
* @Override
- * @Nonnull
- * public LoginException create(String message) {
+ * public @Nonnull LoginException create(String message) {
* return new LoginException(this, message);
* }
*
* @Override
- * @Nonnull
- * public LoginException create(Throwable cause) {
+ * public @Nonnull LoginException create(Throwable cause) {
* return new LoginException(this, cause);
* }
*
* @Override
- * @Nonnull
- * public LoginException create(String message, Throwable cause) {
+ * public @Nonnull LoginException create(String message, Throwable cause) {
* return new LoginException(this, message, cause);
* }
* }
@@ -110,21 +120,32 @@ import xyz.zhouxy.plusone.commons.base.IWithCode;
*
*
* @author ZhouXY
+ * @since 1.0.0
*/
-public interface ExceptionType extends IWithCode {
-
- String getDefaultMessage();
+public interface MultiTypesException> {
@Nonnull
- E create();
+ T getType();
- @Nonnull
- E create(String message);
+ default @Nonnull String getTypeCode() {
+ return getType().getCode();
+ }
- @Nonnull
- E create(Throwable cause);
+ public static interface ExceptionType extends IWithCode {
- @Nonnull
- E create(String message, Throwable cause);
+ String getDefaultMessage();
+ @Nonnull
+ E create();
+
+ @Nonnull
+ E create(String message);
+
+ @Nonnull
+ E create(Throwable cause);
+
+ @Nonnull
+ E create(String message, Throwable cause);
+
+ }
}
diff --git a/src/main/java/xyz/zhouxy/plusone/commons/exception/ParsingFailureException.java b/src/main/java/xyz/zhouxy/plusone/commons/exception/ParsingFailureException.java
index 0a86545..69a1d65 100644
--- a/src/main/java/xyz/zhouxy/plusone/commons/exception/ParsingFailureException.java
+++ b/src/main/java/xyz/zhouxy/plusone/commons/exception/ParsingFailureException.java
@@ -21,6 +21,7 @@ import java.time.format.DateTimeParseException;
import javax.annotation.Nonnull;
import xyz.zhouxy.plusone.commons.exception.business.RequestParamsException;
+import xyz.zhouxy.plusone.commons.exception.MultiTypesException.ExceptionType;
/**
* 解析失败异常
@@ -37,7 +38,9 @@ import xyz.zhouxy.plusone.commons.exception.business.RequestParamsException;
* @author ZhouXY
* @since 0.1.0
*/
-public final class ParsingFailureException extends RuntimeException {
+public final class ParsingFailureException
+ extends RuntimeException
+ implements MultiTypesException {
private final Type type;
@@ -94,14 +97,12 @@ public final class ParsingFailureException extends RuntimeException {
return Type.NUMBER_PARSING_FAILURE.create(message, cause);
}
+ @Override
+ @Nonnull
public Type getType() {
return type;
}
- public String getCode() {
- return this.type.code;
- }
-
public static final Type DEFAULT = Type.DEFAULT;
public static final Type NUMBER_PARSING_FAILURE = Type.NUMBER_PARSING_FAILURE;
public static final Type DATE_TIME_PARSING_FAILURE = Type.DATE_TIME_PARSING_FAILURE;
@@ -127,37 +128,32 @@ public final class ParsingFailureException extends RuntimeException {
}
@Override
- @Nonnull
- public String getCode() {
+ public @Nonnull String getCode() {
return code;
}
@Override
- public String getDefaultMessage() {
+ public @Nonnull String getDefaultMessage() {
return defaultMessage;
}
@Override
- @Nonnull
- public ParsingFailureException create() {
+ public @Nonnull ParsingFailureException create() {
return new ParsingFailureException(this, this.defaultMessage);
}
@Override
- @Nonnull
- public ParsingFailureException create(String message) {
+ public @Nonnull ParsingFailureException create(String message) {
return new ParsingFailureException(this, message);
}
@Override
- @Nonnull
- public ParsingFailureException create(Throwable cause) {
+ public @Nonnull ParsingFailureException create(Throwable cause) {
return new ParsingFailureException(this, cause);
}
@Override
- @Nonnull
- public ParsingFailureException create(String message, Throwable cause) {
+ public @Nonnull ParsingFailureException create(String message, Throwable cause) {
return new ParsingFailureException(this, message, cause);
}
}
diff --git a/src/main/java/xyz/zhouxy/plusone/commons/exception/business/InvalidInputException.java b/src/main/java/xyz/zhouxy/plusone/commons/exception/business/InvalidInputException.java
index aacf7a6..ec4cb55 100644
--- a/src/main/java/xyz/zhouxy/plusone/commons/exception/business/InvalidInputException.java
+++ b/src/main/java/xyz/zhouxy/plusone/commons/exception/business/InvalidInputException.java
@@ -18,7 +18,8 @@ package xyz.zhouxy.plusone.commons.exception.business;
import javax.annotation.Nonnull;
-import xyz.zhouxy.plusone.commons.exception.ExceptionType;
+import xyz.zhouxy.plusone.commons.exception.MultiTypesException.ExceptionType;
+import xyz.zhouxy.plusone.commons.exception.MultiTypesException;
/**
* InvalidInputException
@@ -33,7 +34,9 @@ import xyz.zhouxy.plusone.commons.exception.ExceptionType;
* @author ZhouXY
* @since 0.1.0
*/
-public final class InvalidInputException extends RequestParamsException {
+public final class InvalidInputException
+ extends RequestParamsException
+ implements MultiTypesException {
private final Type type;
@@ -73,14 +76,12 @@ public final class InvalidInputException extends RequestParamsException {
this(Type.DEFAULT, message, cause);
}
+ @Override
+ @Nonnull
public Type getType() {
return this.type;
}
- public Object getCode() {
- return this.type.code;
- }
-
public enum Type implements ExceptionType {
DEFAULT("00", "用户输入内容非法"),
CONTAINS_ILLEGAL_AND_MALICIOUS_LINKS("01", "包含非法恶意跳转链接"),
@@ -90,9 +91,9 @@ public final class InvalidInputException extends RequestParamsException {
;
@Nonnull
- final String code;
+ private final String code;
@Nonnull
- final String defaultMessage;
+ private final String defaultMessage;
Type(String code, String defaultMsg) {
this.code = code;
@@ -100,37 +101,32 @@ public final class InvalidInputException extends RequestParamsException {
}
@Override
- @Nonnull
- public String getCode() {
+ public @Nonnull String getCode() {
return code;
}
@Override
- public String getDefaultMessage() {
+ public @Nonnull String getDefaultMessage() {
return defaultMessage;
}
@Override
- @Nonnull
- public InvalidInputException create() {
+ public @Nonnull InvalidInputException create() {
return new InvalidInputException(this);
}
@Override
- @Nonnull
- public InvalidInputException create(String message) {
+ public @Nonnull InvalidInputException create(String message) {
return new InvalidInputException(this, message);
}
@Override
- @Nonnull
- public InvalidInputException create(Throwable cause) {
+ public @Nonnull InvalidInputException create(Throwable cause) {
return new InvalidInputException(this, cause);
}
@Override
- @Nonnull
- public InvalidInputException create(String message, Throwable cause) {
+ public @Nonnull InvalidInputException create(String message, Throwable cause) {
return new InvalidInputException(this, message, cause);
}
}
diff --git a/src/test/java/xyz/zhouxy/plusone/commons/exception/test/InvalidInputExceptionTests.java b/src/test/java/xyz/zhouxy/plusone/commons/exception/test/InvalidInputExceptionTests.java
index 79a2bfc..8133dc3 100644
--- a/src/test/java/xyz/zhouxy/plusone/commons/exception/test/InvalidInputExceptionTests.java
+++ b/src/test/java/xyz/zhouxy/plusone/commons/exception/test/InvalidInputExceptionTests.java
@@ -38,7 +38,7 @@ public class InvalidInputExceptionTests {
throw InvalidInputException.Type.CONTAINS_ILLEGAL_AND_MALICIOUS_LINKS.create();
});
assertSame(InvalidInputException.Type.CONTAINS_ILLEGAL_AND_MALICIOUS_LINKS, e.getType());
- assertEquals(InvalidInputException.Type.CONTAINS_ILLEGAL_AND_MALICIOUS_LINKS.getCode(), e.getCode());
+ assertEquals(InvalidInputException.Type.CONTAINS_ILLEGAL_AND_MALICIOUS_LINKS.getCode(), e.getTypeCode());
assertEquals(InvalidInputException.Type.CONTAINS_ILLEGAL_AND_MALICIOUS_LINKS.getDefaultMessage(), e.getMessage());
assertNull(e.getCause());
}
@@ -50,7 +50,7 @@ public class InvalidInputExceptionTests {
throw InvalidInputException.Type.CONTAINS_ILLEGAL_WORDS.create(message);
});
assertSame(InvalidInputException.Type.CONTAINS_ILLEGAL_WORDS, e.getType());
- assertEquals(InvalidInputException.Type.CONTAINS_ILLEGAL_WORDS.getCode(), e.getCode());
+ assertEquals(InvalidInputException.Type.CONTAINS_ILLEGAL_WORDS.getCode(), e.getTypeCode());
assertEquals(message, e.getMessage());
assertNull(e.getCause());
}
@@ -62,7 +62,7 @@ public class InvalidInputExceptionTests {
throw InvalidInputException.Type.PICTURE_CONTAINS_ILLEGAL_INFORMATION.create(message);
});
assertSame(InvalidInputException.Type.PICTURE_CONTAINS_ILLEGAL_INFORMATION, e.getType());
- assertEquals(InvalidInputException.Type.PICTURE_CONTAINS_ILLEGAL_INFORMATION.getCode(), e.getCode());
+ assertEquals(InvalidInputException.Type.PICTURE_CONTAINS_ILLEGAL_INFORMATION.getCode(), e.getTypeCode());
assertNull(e.getMessage());
assertNull(e.getCause());
}
@@ -77,7 +77,7 @@ public class InvalidInputExceptionTests {
});
assertSame(InvalidInputException.Type.INFRINGE_COPYRIGHT, e.getType());
- assertEquals(InvalidInputException.Type.INFRINGE_COPYRIGHT.getCode(), e.getCode());
+ assertEquals(InvalidInputException.Type.INFRINGE_COPYRIGHT.getCode(), e.getTypeCode());
log.info("{}", e.getMessage());
assertEquals(nfe.toString(), e.getMessage());
assertSame(nfe, e.getCause());
@@ -92,7 +92,7 @@ public class InvalidInputExceptionTests {
});
assertSame(InvalidInputException.Type.DEFAULT, e.getType());
- assertEquals(InvalidInputException.Type.DEFAULT.getCode(), e.getCode());
+ assertEquals(InvalidInputException.Type.DEFAULT.getCode(), e.getTypeCode());
assertNull(e.getMessage());
assertNull(e.getCause());
}
@@ -106,7 +106,7 @@ public class InvalidInputExceptionTests {
throw InvalidInputException.Type.CONTAINS_ILLEGAL_AND_MALICIOUS_LINKS.create(message, nfe);
});
assertSame(InvalidInputException.Type.CONTAINS_ILLEGAL_AND_MALICIOUS_LINKS, e.getType());
- assertEquals(InvalidInputException.Type.CONTAINS_ILLEGAL_AND_MALICIOUS_LINKS.getCode(), e.getCode());
+ assertEquals(InvalidInputException.Type.CONTAINS_ILLEGAL_AND_MALICIOUS_LINKS.getCode(), e.getTypeCode());
assertEquals(message, e.getMessage());
assertSame(nfe, e.getCause());
}
@@ -120,7 +120,7 @@ public class InvalidInputExceptionTests {
throw InvalidInputException.Type.CONTAINS_ILLEGAL_WORDS.create(message, nfe);
});
assertSame(InvalidInputException.Type.CONTAINS_ILLEGAL_WORDS, e.getType());
- assertEquals(InvalidInputException.Type.CONTAINS_ILLEGAL_WORDS.getCode(), e.getCode());
+ assertEquals(InvalidInputException.Type.CONTAINS_ILLEGAL_WORDS.getCode(), e.getTypeCode());
assertNull(e.getMessage());
assertSame(nfe, e.getCause());
}
@@ -134,7 +134,7 @@ public class InvalidInputExceptionTests {
throw InvalidInputException.Type.CONTAINS_ILLEGAL_WORDS.create(message, npe);
});
assertSame(InvalidInputException.Type.CONTAINS_ILLEGAL_WORDS, e.getType());
- assertEquals(InvalidInputException.Type.CONTAINS_ILLEGAL_WORDS.getCode(), e.getCode());
+ assertEquals(InvalidInputException.Type.CONTAINS_ILLEGAL_WORDS.getCode(), e.getTypeCode());
assertEquals(message, e.getMessage());
assertNull(e.getCause());
}
@@ -148,7 +148,7 @@ public class InvalidInputExceptionTests {
throw InvalidInputException.Type.CONTAINS_ILLEGAL_WORDS.create(message, nfe);
});
assertSame(InvalidInputException.Type.CONTAINS_ILLEGAL_WORDS, e.getType());
- assertEquals(InvalidInputException.Type.CONTAINS_ILLEGAL_WORDS.getCode(), e.getCode());
+ assertEquals(InvalidInputException.Type.CONTAINS_ILLEGAL_WORDS.getCode(), e.getTypeCode());
assertNull(e.getMessage());
assertNull(e.getCause());
}
@@ -167,7 +167,7 @@ public class InvalidInputExceptionTests {
throw new InvalidInputException();
});
assertSame(InvalidInputException.Type.DEFAULT, e.getType());
- assertEquals(InvalidInputException.Type.DEFAULT.getCode(), e.getCode());
+ assertEquals(InvalidInputException.Type.DEFAULT.getCode(), e.getTypeCode());
assertEquals(InvalidInputException.Type.DEFAULT.getDefaultMessage(), e.getMessage());
assertNull(e.getCause());
}
@@ -179,7 +179,7 @@ public class InvalidInputExceptionTests {
throw new InvalidInputException(message);
});
assertSame(InvalidInputException.Type.DEFAULT, e.getType());
- assertEquals(InvalidInputException.Type.DEFAULT.getCode(), e.getCode());
+ assertEquals(InvalidInputException.Type.DEFAULT.getCode(), e.getTypeCode());
assertEquals(message, e.getMessage());
assertNull(e.getCause());
}
@@ -191,7 +191,7 @@ public class InvalidInputExceptionTests {
throw new InvalidInputException(message);
});
assertSame(InvalidInputException.Type.DEFAULT, e.getType());
- assertEquals(InvalidInputException.Type.DEFAULT.getCode(), e.getCode());
+ assertEquals(InvalidInputException.Type.DEFAULT.getCode(), e.getTypeCode());
assertNull(e.getMessage());
assertNull(e.getCause());
}
@@ -206,7 +206,7 @@ public class InvalidInputExceptionTests {
});
assertSame(InvalidInputException.Type.DEFAULT, e.getType());
- assertEquals(InvalidInputException.Type.DEFAULT.getCode(), e.getCode());
+ assertEquals(InvalidInputException.Type.DEFAULT.getCode(), e.getTypeCode());
log.info("{}", e.getMessage());
assertEquals(nfe.toString(), e.getMessage());
assertSame(nfe, e.getCause());
@@ -221,7 +221,7 @@ public class InvalidInputExceptionTests {
});
assertSame(InvalidInputException.Type.DEFAULT, e.getType());
- assertEquals(InvalidInputException.Type.DEFAULT.getCode(), e.getCode());
+ assertEquals(InvalidInputException.Type.DEFAULT.getCode(), e.getTypeCode());
assertNull(e.getMessage());
assertNull(e.getCause());
}
@@ -235,7 +235,7 @@ public class InvalidInputExceptionTests {
throw new InvalidInputException(message, nfe);
});
assertSame(InvalidInputException.Type.DEFAULT, e.getType());
- assertEquals(InvalidInputException.Type.DEFAULT.getCode(), e.getCode());
+ assertEquals(InvalidInputException.Type.DEFAULT.getCode(), e.getTypeCode());
assertEquals(message, e.getMessage());
assertSame(nfe, e.getCause());
}
@@ -249,7 +249,7 @@ public class InvalidInputExceptionTests {
throw new InvalidInputException(message, nfe);
});
assertSame(InvalidInputException.Type.DEFAULT, e.getType());
- assertEquals(InvalidInputException.Type.DEFAULT.getCode(), e.getCode());
+ assertEquals(InvalidInputException.Type.DEFAULT.getCode(), e.getTypeCode());
assertNull(e.getMessage());
assertSame(nfe, e.getCause());
}
@@ -263,7 +263,7 @@ public class InvalidInputExceptionTests {
throw new InvalidInputException(message, npe);
});
assertSame(InvalidInputException.Type.DEFAULT, e.getType());
- assertEquals(InvalidInputException.Type.DEFAULT.getCode(), e.getCode());
+ assertEquals(InvalidInputException.Type.DEFAULT.getCode(), e.getTypeCode());
assertEquals(message, e.getMessage());
assertNull(e.getCause());
}
@@ -277,7 +277,7 @@ public class InvalidInputExceptionTests {
throw new InvalidInputException(message, nfe);
});
assertSame(InvalidInputException.Type.DEFAULT, e.getType());
- assertEquals(InvalidInputException.Type.DEFAULT.getCode(), e.getCode());
+ assertEquals(InvalidInputException.Type.DEFAULT.getCode(), e.getTypeCode());
assertNull(e.getMessage());
assertNull(e.getCause());
}
diff --git a/src/test/java/xyz/zhouxy/plusone/commons/exception/test/ParsingFailureExceptionTests.java b/src/test/java/xyz/zhouxy/plusone/commons/exception/test/ParsingFailureExceptionTests.java
index 13ecd13..77d31a4 100644
--- a/src/test/java/xyz/zhouxy/plusone/commons/exception/test/ParsingFailureExceptionTests.java
+++ b/src/test/java/xyz/zhouxy/plusone/commons/exception/test/ParsingFailureExceptionTests.java
@@ -41,7 +41,7 @@ public class ParsingFailureExceptionTests {
throw ParsingFailureException.DATE_TIME_PARSING_FAILURE.create();
});
assertSame(ParsingFailureException.DATE_TIME_PARSING_FAILURE, e.getType());
- assertEquals(ParsingFailureException.DATE_TIME_PARSING_FAILURE.getCode(), e.getCode());
+ assertEquals(ParsingFailureException.DATE_TIME_PARSING_FAILURE.getCode(), e.getTypeCode());
assertEquals(ParsingFailureException.DATE_TIME_PARSING_FAILURE.getDefaultMessage(), e.getMessage());
assertNull(e.getCause());
}
@@ -53,7 +53,7 @@ public class ParsingFailureExceptionTests {
throw ParsingFailureException.JSON_PARSING_FAILURE.create(message);
});
assertSame(ParsingFailureException.Type.JSON_PARSING_FAILURE, e.getType());
- assertEquals(ParsingFailureException.Type.JSON_PARSING_FAILURE.getCode(), e.getCode());
+ assertEquals(ParsingFailureException.Type.JSON_PARSING_FAILURE.getCode(), e.getTypeCode());
assertEquals(message, e.getMessage());
assertNull(e.getCause());
}
@@ -65,7 +65,7 @@ public class ParsingFailureExceptionTests {
throw ParsingFailureException.XML_PARSING_FAILURE.create(message);
});
assertSame(ParsingFailureException.XML_PARSING_FAILURE, e.getType());
- assertEquals(ParsingFailureException.XML_PARSING_FAILURE.getCode(), e.getCode());
+ assertEquals(ParsingFailureException.XML_PARSING_FAILURE.getCode(), e.getTypeCode());
assertNull(e.getMessage());
assertNull(e.getCause());
}
@@ -80,7 +80,7 @@ public class ParsingFailureExceptionTests {
});
assertSame(ParsingFailureException.NUMBER_PARSING_FAILURE, e.getType());
- assertEquals(ParsingFailureException.NUMBER_PARSING_FAILURE.getCode(), e.getCode());
+ assertEquals(ParsingFailureException.NUMBER_PARSING_FAILURE.getCode(), e.getTypeCode());
log.info("{}", e.getMessage());
assertEquals(nfe.toString(), e.getMessage());
assertSame(nfe, e.getCause());
@@ -95,7 +95,7 @@ public class ParsingFailureExceptionTests {
});
assertSame(ParsingFailureException.NUMBER_PARSING_FAILURE, e.getType());
- assertEquals(ParsingFailureException.NUMBER_PARSING_FAILURE.getCode(), e.getCode());
+ assertEquals(ParsingFailureException.NUMBER_PARSING_FAILURE.getCode(), e.getTypeCode());
assertNull(e.getMessage());
assertNull(e.getCause());
}
@@ -109,7 +109,7 @@ public class ParsingFailureExceptionTests {
throw ParsingFailureException.NUMBER_PARSING_FAILURE.create(message, nfe);
});
assertSame(ParsingFailureException.NUMBER_PARSING_FAILURE, e.getType());
- assertEquals(ParsingFailureException.NUMBER_PARSING_FAILURE.getCode(), e.getCode());
+ assertEquals(ParsingFailureException.NUMBER_PARSING_FAILURE.getCode(), e.getTypeCode());
assertEquals(message, e.getMessage());
assertSame(nfe, e.getCause());
}
@@ -123,7 +123,7 @@ public class ParsingFailureExceptionTests {
throw ParsingFailureException.DATE_TIME_PARSING_FAILURE.create(message, nfe);
});
assertSame(ParsingFailureException.DATE_TIME_PARSING_FAILURE, e.getType());
- assertEquals(ParsingFailureException.DATE_TIME_PARSING_FAILURE.getCode(), e.getCode());
+ assertEquals(ParsingFailureException.DATE_TIME_PARSING_FAILURE.getCode(), e.getTypeCode());
assertNull(e.getMessage());
assertSame(nfe, e.getCause());
}
@@ -137,7 +137,7 @@ public class ParsingFailureExceptionTests {
throw ParsingFailureException.DATE_TIME_PARSING_FAILURE.create(message, npe);
});
assertSame(ParsingFailureException.DATE_TIME_PARSING_FAILURE, e.getType());
- assertEquals(ParsingFailureException.DATE_TIME_PARSING_FAILURE.getCode(), e.getCode());
+ assertEquals(ParsingFailureException.DATE_TIME_PARSING_FAILURE.getCode(), e.getTypeCode());
assertEquals(message, e.getMessage());
assertNull(e.getCause());
}
@@ -151,7 +151,7 @@ public class ParsingFailureExceptionTests {
throw ParsingFailureException.DATE_TIME_PARSING_FAILURE.create(message, nfe);
});
assertSame(ParsingFailureException.DATE_TIME_PARSING_FAILURE, e.getType());
- assertEquals(ParsingFailureException.DATE_TIME_PARSING_FAILURE.getCode(), e.getCode());
+ assertEquals(ParsingFailureException.DATE_TIME_PARSING_FAILURE.getCode(), e.getTypeCode());
assertNull(e.getMessage());
assertNull(e.getCause());
}
@@ -175,7 +175,7 @@ public class ParsingFailureExceptionTests {
});
assertSame(ParsingFailureException.DATE_TIME_PARSING_FAILURE, e.getType());
- assertEquals(ParsingFailureException.DATE_TIME_PARSING_FAILURE.getCode(), e.getCode());
+ assertEquals(ParsingFailureException.DATE_TIME_PARSING_FAILURE.getCode(), e.getTypeCode());
assertEquals(dtpe.getMessage(), e.getMessage());
assertSame(dtpe, e.getCause());
}
@@ -189,7 +189,7 @@ public class ParsingFailureExceptionTests {
});
assertSame(ParsingFailureException.DATE_TIME_PARSING_FAILURE, e.getType());
- assertEquals(ParsingFailureException.DATE_TIME_PARSING_FAILURE.getCode(), e.getCode());
+ assertEquals(ParsingFailureException.DATE_TIME_PARSING_FAILURE.getCode(), e.getTypeCode());
assertEquals(ParsingFailureException.DATE_TIME_PARSING_FAILURE.getDefaultMessage(), e.getMessage());
assertNull(e.getCause());
}
@@ -206,7 +206,7 @@ public class ParsingFailureExceptionTests {
});
assertSame(ParsingFailureException.DATE_TIME_PARSING_FAILURE, e.getType());
- assertEquals(ParsingFailureException.DATE_TIME_PARSING_FAILURE.getCode(), e.getCode());
+ assertEquals(ParsingFailureException.DATE_TIME_PARSING_FAILURE.getCode(), e.getTypeCode());
assertEquals(message, e.getMessage());
assertSame(dtpe, e.getCause());
}
@@ -223,7 +223,7 @@ public class ParsingFailureExceptionTests {
});
assertSame(ParsingFailureException.DATE_TIME_PARSING_FAILURE, e.getType());
- assertEquals(ParsingFailureException.DATE_TIME_PARSING_FAILURE.getCode(), e.getCode());
+ assertEquals(ParsingFailureException.DATE_TIME_PARSING_FAILURE.getCode(), e.getTypeCode());
assertNull(e.getMessage());
assertSame(dtpe, e.getCause());
}
@@ -238,7 +238,7 @@ public class ParsingFailureExceptionTests {
});
assertSame(ParsingFailureException.DATE_TIME_PARSING_FAILURE, e.getType());
- assertEquals(ParsingFailureException.DATE_TIME_PARSING_FAILURE.getCode(), e.getCode());
+ assertEquals(ParsingFailureException.DATE_TIME_PARSING_FAILURE.getCode(), e.getTypeCode());
assertEquals(message, e.getMessage());
assertNull(e.getCause());
}
@@ -253,7 +253,7 @@ public class ParsingFailureExceptionTests {
});
assertSame(ParsingFailureException.DATE_TIME_PARSING_FAILURE, e.getType());
- assertEquals(ParsingFailureException.DATE_TIME_PARSING_FAILURE.getCode(), e.getCode());
+ assertEquals(ParsingFailureException.DATE_TIME_PARSING_FAILURE.getCode(), e.getTypeCode());
assertNull(e.getMessage());
assertNull(e.getCause());
}
@@ -277,7 +277,7 @@ public class ParsingFailureExceptionTests {
});
assertSame(ParsingFailureException.NUMBER_PARSING_FAILURE, e.getType());
- assertEquals(ParsingFailureException.NUMBER_PARSING_FAILURE.getCode(), e.getCode());
+ assertEquals(ParsingFailureException.NUMBER_PARSING_FAILURE.getCode(), e.getTypeCode());
assertEquals(dtpe.getMessage(), e.getMessage());
assertSame(dtpe, e.getCause());
}
@@ -291,7 +291,7 @@ public class ParsingFailureExceptionTests {
});
assertSame(ParsingFailureException.NUMBER_PARSING_FAILURE, e.getType());
- assertEquals(ParsingFailureException.NUMBER_PARSING_FAILURE.getCode(), e.getCode());
+ assertEquals(ParsingFailureException.NUMBER_PARSING_FAILURE.getCode(), e.getTypeCode());
assertEquals(ParsingFailureException.NUMBER_PARSING_FAILURE.getDefaultMessage(), e.getMessage());
assertNull(e.getCause());
}
@@ -308,7 +308,7 @@ public class ParsingFailureExceptionTests {
});
assertSame(ParsingFailureException.NUMBER_PARSING_FAILURE, e.getType());
- assertEquals(ParsingFailureException.NUMBER_PARSING_FAILURE.getCode(), e.getCode());
+ assertEquals(ParsingFailureException.NUMBER_PARSING_FAILURE.getCode(), e.getTypeCode());
assertEquals(message, e.getMessage());
assertSame(dtpe, e.getCause());
}
@@ -325,7 +325,7 @@ public class ParsingFailureExceptionTests {
});
assertSame(ParsingFailureException.NUMBER_PARSING_FAILURE, e.getType());
- assertEquals(ParsingFailureException.NUMBER_PARSING_FAILURE.getCode(), e.getCode());
+ assertEquals(ParsingFailureException.NUMBER_PARSING_FAILURE.getCode(), e.getTypeCode());
assertNull(e.getMessage());
assertSame(dtpe, e.getCause());
}
@@ -340,7 +340,7 @@ public class ParsingFailureExceptionTests {
});
assertSame(ParsingFailureException.NUMBER_PARSING_FAILURE, e.getType());
- assertEquals(ParsingFailureException.NUMBER_PARSING_FAILURE.getCode(), e.getCode());
+ assertEquals(ParsingFailureException.NUMBER_PARSING_FAILURE.getCode(), e.getTypeCode());
assertEquals(message, e.getMessage());
assertNull(e.getCause());
}
@@ -355,7 +355,7 @@ public class ParsingFailureExceptionTests {
});
assertSame(ParsingFailureException.NUMBER_PARSING_FAILURE, e.getType());
- assertEquals(ParsingFailureException.NUMBER_PARSING_FAILURE.getCode(), e.getCode());
+ assertEquals(ParsingFailureException.NUMBER_PARSING_FAILURE.getCode(), e.getTypeCode());
assertNull(e.getMessage());
assertNull(e.getCause());
}