Skip to content

Commit

Permalink
remove setter in enum class
Browse files Browse the repository at this point in the history
  • Loading branch information
YongGoose committed Mar 8, 2025
1 parent 3a830c7 commit d0cd289
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 29 deletions.
22 changes: 2 additions & 20 deletions common/src/main/java/org/apache/seata/common/result/Code.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,12 @@ public enum Code {
/**
* The Code.
*/
public String code;
public final String code;

/**
* The Msg.
*/
public String msg;
public final String msg;

private Code(String code, String msg) {
this.code = code;
Expand All @@ -55,15 +55,6 @@ public String getCode() {
return this.code;
}

/**
* Sets code.
*
* @param code the code
*/
public void setCode(String code) {
this.code = code;
}

/**
* Gets msg.
*
Expand All @@ -73,15 +64,6 @@ public String getMsg() {
return msg;
}

/**
* Sets msg.
*
* @param msg the msg
*/
public void setMsg(String msg) {
this.msg = msg;
}

/**
* Gets error msg.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,4 @@ public void testGetErrorMsgWithInvalidCodeReturnsNull() {
// Test case for non-existing code
assertNull(Code.getErrorMsg("404"));
}

@Test
public void testSetCodeAndMsgUpdatesValuesCorrectly() {
// Test case to check if setCode and setMsg are working as expected
Code.SUCCESS.setCode("201");
Code.SUCCESS.setMsg("Created");
assertEquals("201", Code.SUCCESS.getCode());
assertEquals("Created", Code.SUCCESS.getMsg());
}
}

0 comments on commit d0cd289

Please sign in to comment.