From ba8673f2fee72b50faffd9518e390ae2a1927bfa Mon Sep 17 00:00:00 2001 From: sttk Date: Sun, 1 Oct 2023 00:26:20 +0900 Subject: [PATCH] update!: changed FailToRunLogic' field to a logic class --- src/main/java/com/github/sttk/sabi/DaxBase.java | 6 +++--- src/test/java/com/github/sttk/sabi/DaxBaseTest.java | 6 ++---- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/src/main/java/com/github/sttk/sabi/DaxBase.java b/src/main/java/com/github/sttk/sabi/DaxBase.java index 906e591..8eb3fa2 100644 --- a/src/main/java/com/github/sttk/sabi/DaxBase.java +++ b/src/main/java/com/github/sttk/sabi/DaxBase.java @@ -78,9 +78,9 @@ public record CreatedDaxConnIsNull(String name) {} * {@code FailToRunLogic} is the error reason which indicates that a logic * failed to run. * - * @param logic The logic class name failed. + * @param logicType The logic class failed. */ - public record FailToRunLogic(String logic) {} + public record FailToRunLogic(Class logicType) {} /** The flag to prevent further registration of global {@link DaxSrc}(s). */ private static boolean isGlobalDaxSrcsFixed; @@ -401,7 +401,7 @@ public final void txn(Logic ...logics) throws Err { } catch (Err e) { throw e; } catch (Exception e) { - throw new Err(new FailToRunLogic(logic.getClass().getName()), e); + throw new Err(new FailToRunLogic(logic.getClass()), e); } } diff --git a/src/test/java/com/github/sttk/sabi/DaxBaseTest.java b/src/test/java/com/github/sttk/sabi/DaxBaseTest.java index f9c0a1f..a4c1d3b 100644 --- a/src/test/java/com/github/sttk/sabi/DaxBaseTest.java +++ b/src/test/java/com/github/sttk/sabi/DaxBaseTest.java @@ -536,8 +536,7 @@ class MyDaxBase extends DaxBase implements MyDax {} } catch (Err e) { switch (e.getReason()) { case FailToRunLogic r: { - assertThat(r.logic()).isEqualTo( - "com.github.sttk.sabi.DaxBaseTest$1MyLogic"); + assertThat(r.logicType()).isEqualTo(MyLogic.class); assertThat(e.getCause()).isInstanceOf(ClassCastException.class); break; } @@ -587,8 +586,7 @@ class MyDaxBase extends DaxBase implements MyDax {} } catch (Err e) { switch (e.getReason()) { case FailToRunLogic r: { - assertThat(r.logic()).isEqualTo( - "com.github.sttk.sabi.DaxBaseTest$2MyLogic"); + assertThat(r.logicType()).isEqualTo(MyLogic.class); assertThat(e.getCause()).isInstanceOf(ClassCastException.class); break; }