260616_14_이인준#60
Conversation
Walkthrough
ChangesRPG 클래스 계층 확장
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 9
🧹 Nitpick comments (5)
game/src/main/java/com/survivalcoding/Diagram.puml (1)
36-39: ⚡ Quick winPlantUML 상속 표기법 명확성 개선.
GreatWizard (L36-39)와 PoisonSlime (L56-59) 클래스 정의에서 부모 클래스 상속이 명시되지 않습니다. PlantUML에서는 클래스 선언 시 명시적으로 부모를 표기하거나, 현재처럼 L63-64의 화살표로만 나타낼 수 있습니다. 그러나 다이어그램의 가독성을 높이기 위해 클래스 정의에서 상속을 명확히 표기하는 것이 권장됩니다:
class GreatWizard extends Wizard { ... } class PoisonSlime extends Slime { ... }이렇게 수정하면 다이어그램의 상속 계층이 더욱 명확해집니다.
Also applies to: 56-59
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@game/src/main/java/com/survivalcoding/Diagram.puml` around lines 36 - 39, The PlantUML diagram has inheritance relationships defined via arrows but not explicitly shown in the class declarations, reducing clarity. In Diagram.puml at lines 36-39, modify the GreatWizard class declaration to explicitly extend Wizard by adding "extends Wizard" after the class name. Similarly, in Diagram.puml at lines 56-59, modify the PoisonSlime class declaration to explicitly extend Slime by adding "extends Slime" after the class name. This makes the inheritance hierarchy immediately visible in the class definitions rather than only through separate arrow notations.game/src/main/java/com/survivalcoding/Slime.java (2)
12-12: ⚡ Quick win메서드 접근 제어자를
public으로 변경 권장UML 다이어그램에서
attack(Hero)메서드가 public(+)으로 명시되어 있습니다. 현재 접근 제어자가 없어 package-private으로 설정되므로,public을 명시적으로 추가하는 것이 설계 의도와 일치합니다.♻️ 제안된 수정
- void attack(Hero hero) { + public void attack(Hero hero) {🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@game/src/main/java/com/survivalcoding/Slime.java` at line 12, The attack method in the Slime class is currently missing an explicit access modifier and defaults to package-private visibility, but the UML diagram specifies it should be public. Add the public keyword to the attack(Hero hero) method signature in the Slime class to align with the design intent and make the method publicly accessible.
4-5: ⚡ Quick win필드에 명시적 접근 제어자 추가 권장
suffix와hp필드에 접근 제어자가 명시되지 않아 package-private으로 설정됩니다. 캡슐화를 위해private으로 선언하고 필요시 getter/setter를 제공하는 것이 좋습니다.♻️ 제안된 수정
- String suffix; - int hp; + private String suffix; + private int hp;🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@game/src/main/java/com/survivalcoding/Slime.java` around lines 4 - 5, The fields `suffix` and `hp` in the Slime class lack explicit access modifiers and are currently package-private by default, which breaks encapsulation principles. Add the `private` access modifier to both the `suffix` and `hp` field declarations to restrict direct access from outside the class, and then provide public getter and setter methods for these fields to allow controlled access where needed.game/src/main/java/com/survivalcoding/PoisonSlime.java (2)
12-12: ⚡ Quick win메서드 접근 제어자를
public으로 변경 권장부모 클래스의
attack메서드와 마찬가지로 UML 다이어그램 명세에 따라public으로 선언하는 것이 좋습니다.♻️ 제안된 수정
`@Override` - void attack(Hero hero) { + public void attack(Hero hero) {🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@game/src/main/java/com/survivalcoding/PoisonSlime.java` at line 12, The attack method in the PoisonSlime class is currently declared without an explicit access modifier (defaulting to package-private visibility). According to the UML diagram specification and to match the parent class declaration, change the attack method to use the public access modifier. Update the method signature by adding the public keyword before the return type void in the attack method that takes a Hero parameter.
18-19: 💤 Low value
getHp()호출 결과 캐싱 고려Line 18과 19에서
hero.getHp()를 연속으로 두 번 호출합니다. 가독성과 미세한 성능 개선을 위해 결과를 변수에 저장하는 것을 고려하세요.♻️ 제안된 수정
+ int currentHp = hero.getHp(); - int poisonDamage = hero.getHp() / 5; - hero.setHp(hero.getHp() - poisonDamage); + int poisonDamage = currentHp / 5; + hero.setHp(currentHp - poisonDamage); System.out.println(poisonDamage + " point damage");🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@game/src/main/java/com/survivalcoding/PoisonSlime.java` around lines 18 - 19, The method in the PoisonSlime class calls hero.getHp() twice in consecutive lines (once for calculating poisonDamage and once for setHp), which is inefficient and reduces readability. Store the result of the first hero.getHp() call in a local variable (such as currentHp), and then use this variable in both the poisonDamage calculation and the hero.setHp() call to eliminate the redundant method invocation.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@game/src/main/java/com/survivalcoding/Diagram.puml`:
- Around line 50-54: The Slime class fields in Diagram.puml are marked with `+`
(public visibility) on lines 51-52 for suffix and hp, but the actual Slime.java
implementation defines these as package-private fields with no visibility
modifier. Update the diagram to match the implementation by changing the `+`
prefix to `~` (package-private notation in UML) for both the suffix and hp
fields in the Slime class definition.
- Around line 15-18: The Cleric class diagram shows mp field with public
visibility (+), but this does not match the encapsulation pattern used by Hero
and Wizard classes which use private fields with accessor methods. Update the
Cleric class in the diagram by changing mp, hp, and name field visibility from
public (+) to private (-), and add the corresponding getter and setter methods
to align with the encapsulation pattern demonstrated in Hero and Wizard classes.
Ensure all three fields (mp, hp, name) follow consistent private visibility
notation in the diagram.
In `@game/src/main/java/com/survivalcoding/Hero.java`:
- Around line 24-30: The setMaxHp method in the Hero class does not enforce the
invariant that hp should never exceed maxHp, and it does not validate that maxHp
is a positive value. Modify the setMaxHp method to first validate that the input
value is greater than zero, then adjust the current hp if it exceeds the new
maxHp (by clamping hp to the new maximum). This ensures the state invariant hp
<= maxHp is always maintained and prevents invalid states where hp exceeds
maxHp.
In `@game/src/main/java/com/survivalcoding/PoisonSlime.java`:
- Line 20: The System.out.println statement in PoisonSlime.java is missing a
space between the poisonDamage variable and the string literal "point damage".
Add a space at the beginning of the string literal so that the output displays
properly (e.g., "10 point damage" instead of "10point damage").
- Around line 6-9: The PoisonSlime constructor is performing a redundant
assignment of the suffix field. The super(suffix) call on line 7 already
initializes the suffix field through the parent class constructor, making the
this.suffix = suffix assignment on line 8 unnecessary. Remove the duplicate
assignment statement to eliminate the redundant code and keep only the super()
call in the PoisonSlime constructor.
In `@game/src/main/java/com/survivalcoding/Slime.java`:
- Line 5: The `hp` field in the Slime class is declared but never initialized in
the constructor and is not used anywhere in the class methods. Either remove the
unused `hp` field entirely if it is not needed, or if the field should be part
of the Slime class functionality, initialize it in the Slime constructor with an
appropriate default value and ensure it is actually used in relevant methods.
- Line 16: The Hero's HP can become negative when damage is applied,
compromising game state integrity. In
game/src/main/java/com/survivalcoding/Slime.java at line 16, modify the damage
calculation in the basic attack (10 damage) by storing the new HP in a variable
and use Math.max(0, newHp) before setting it on the hero to ensure HP never goes
below zero. Apply the same fix in
game/src/main/java/com/survivalcoding/PoisonSlime.java at line 19 for the poison
damage application, using Math.max(0, newHp) to prevent HP from becoming
negative when poison damage is applied.
- Line 13: The System.out.println statement in the Slime class is missing a
space between the suffix variable and the "attacked" string literal, causing
output like "Slime Aattacked" instead of "Slime A attacked". Add a space before
"attacked" in the concatenated string to fix the formatting issue.
In `@game/src/test/java/com/survivalcoding/WizardTest.java`:
- Around line 81-93: The test method
heal_prints_insufficient_message_when_mp_under_10 has a DisplayName that
indicates it verifies a message is printed, but the actual test only checks that
HP and MP remain unchanged without capturing or asserting any output. Either
update the `@DisplayName` annotation to accurately describe what the test actually
verifies (state preservation when MP is insufficient) or add stdout capture and
assertion to verify that the mana insufficient message is actually printed to
match the test's declared intent.
---
Nitpick comments:
In `@game/src/main/java/com/survivalcoding/Diagram.puml`:
- Around line 36-39: The PlantUML diagram has inheritance relationships defined
via arrows but not explicitly shown in the class declarations, reducing clarity.
In Diagram.puml at lines 36-39, modify the GreatWizard class declaration to
explicitly extend Wizard by adding "extends Wizard" after the class name.
Similarly, in Diagram.puml at lines 56-59, modify the PoisonSlime class
declaration to explicitly extend Slime by adding "extends Slime" after the class
name. This makes the inheritance hierarchy immediately visible in the class
definitions rather than only through separate arrow notations.
In `@game/src/main/java/com/survivalcoding/PoisonSlime.java`:
- Line 12: The attack method in the PoisonSlime class is currently declared
without an explicit access modifier (defaulting to package-private visibility).
According to the UML diagram specification and to match the parent class
declaration, change the attack method to use the public access modifier. Update
the method signature by adding the public keyword before the return type void in
the attack method that takes a Hero parameter.
- Around line 18-19: The method in the PoisonSlime class calls hero.getHp()
twice in consecutive lines (once for calculating poisonDamage and once for
setHp), which is inefficient and reduces readability. Store the result of the
first hero.getHp() call in a local variable (such as currentHp), and then use
this variable in both the poisonDamage calculation and the hero.setHp() call to
eliminate the redundant method invocation.
In `@game/src/main/java/com/survivalcoding/Slime.java`:
- Line 12: The attack method in the Slime class is currently missing an explicit
access modifier and defaults to package-private visibility, but the UML diagram
specifies it should be public. Add the public keyword to the attack(Hero hero)
method signature in the Slime class to align with the design intent and make the
method publicly accessible.
- Around line 4-5: The fields `suffix` and `hp` in the Slime class lack explicit
access modifiers and are currently package-private by default, which breaks
encapsulation principles. Add the `private` access modifier to both the `suffix`
and `hp` field declarations to restrict direct access from outside the class,
and then provide public getter and setter methods for these fields to allow
controlled access where needed.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 2e02ccc4-6f3d-4612-948b-ee3f60dab529
📒 Files selected for processing (8)
game/src/main/java/com/survivalcoding/Diagram.pumlgame/src/main/java/com/survivalcoding/GreatWizard.javagame/src/main/java/com/survivalcoding/Hero.javagame/src/main/java/com/survivalcoding/PoisonSlime.javagame/src/main/java/com/survivalcoding/Question0102.javagame/src/main/java/com/survivalcoding/Slime.javagame/src/main/java/com/survivalcoding/Wizard.javagame/src/test/java/com/survivalcoding/WizardTest.java
| class Cleric { | ||
| + int mp | ||
| + heal(Hero) : void | ||
| } |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# Cleric 클래스의 실제 구현에서 mp 필드 가시성과 접근자 확인
rg -A 10 'class Cleric' game/src/main/java/com/survivalcoding/Repository: SurvivalCodingCampus/polytech_java2
Length of output: 1602
🏁 Script executed:
#!/bin/bash
# Read full Cleric.java to see complete field declarations
cat -n game/src/main/java/com/survivalcoding/Cleric.java | head -30
echo "---"
# Also check Hero.java and Wizard.java for comparison
echo "=== Hero.java fields ==="
rg -A 5 'public class Hero' game/src/main/java/com/survivalcoding/Hero.java | head -20
echo "=== Wizard.java fields ==="
rg -A 10 'public class Wizard' game/src/main/java/com/survivalcoding/Wizard.java | head -20Repository: SurvivalCodingCampus/polytech_java2
Length of output: 1290
Cleric 필드 가시성 및 캡슐화 패턴 불일치 수정 필요.
다이어그램(Line 16)에서 + int mp로 표시되어 있으나, 실제 Cleric.java 구현에서는 default access(제한자 없음)로 선언되어 있습니다. 더 중요하게는, Hero와 Wizard 클래스는 private 필드와 getter/setter 메서드를 통해 캡슐화를 구현하고 있으므로, Cleric도 이 패턴을 따르도록 수정해야 합니다. 다이어그램의 mp, hp, name을 모두 private(-)로 변경하고, 해당 접근자 메서드를 추가하거나 기존 구현과 동기화하세요.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@game/src/main/java/com/survivalcoding/Diagram.puml` around lines 15 - 18, The
Cleric class diagram shows mp field with public visibility (+), but this does
not match the encapsulation pattern used by Hero and Wizard classes which use
private fields with accessor methods. Update the Cleric class in the diagram by
changing mp, hp, and name field visibility from public (+) to private (-), and
add the corresponding getter and setter methods to align with the encapsulation
pattern demonstrated in Hero and Wizard classes. Ensure all three fields (mp,
hp, name) follow consistent private visibility notation in the diagram.
| class Slime { | ||
| + String suffix | ||
| + int hp | ||
| + attack(Hero) : void | ||
| } |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# Slime 클래스의 실제 구현에서 suffix, hp 필드 가시성 확인
rg -A 15 'class Slime' game/src/main/java/com/survivalcoding/Slime.javaRepository: SurvivalCodingCampus/polytech_java2
Length of output: 388
Slime 클래스 필드 가시성이 다이어그램과 일치하지 않음.
Diagram.puml의 51-52줄에서 suffix와 hp가 + (public)으로 표기되어 있으나, 실제 Slime.java 구현에서는 가시성 지정자가 없는 package-private 필드입니다. 다이어그램을 실제 구현(String suffix;, int hp;)과 일치하도록 수정하세요.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@game/src/main/java/com/survivalcoding/Diagram.puml` around lines 50 - 54, The
Slime class fields in Diagram.puml are marked with `+` (public visibility) on
lines 51-52 for suffix and hp, but the actual Slime.java implementation defines
these as package-private fields with no visibility modifier. Update the diagram
to match the implementation by changing the `+` prefix to `~` (package-private
notation in UML) for both the suffix and hp fields in the Slime class
definition.
| public int getMaxHp() { | ||
| return maxHp; | ||
| } | ||
|
|
||
| public void setMaxHp(int maxHp) { | ||
| this.maxHp = maxHp; | ||
| } |
There was a problem hiding this comment.
hp/maxHp 상태 불변식이 보장되지 않습니다.
setMaxHp가 유효성(음수/0)과 현재 hp 보정을 처리하지 않아 hp > maxHp 같은 모순 상태가 생길 수 있습니다. 치유 로직이 여러 클래스로 확장된 만큼 Hero에서 상한/하한을 강제해야 합니다.
제안 수정안
public void setHp(int hp) {
- this.hp = hp;
+ if (hp < 0) {
+ hp = 0;
+ }
+ if (hp > this.maxHp) {
+ hp = this.maxHp;
+ }
+ this.hp = hp;
}
public void setMaxHp(int maxHp) {
- this.maxHp = maxHp;
+ if (maxHp < 0) {
+ throw new IllegalArgumentException("maxHp must be over 0.");
+ }
+ this.maxHp = maxHp;
+ if (this.hp > maxHp) {
+ this.hp = maxHp;
+ }
}🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@game/src/main/java/com/survivalcoding/Hero.java` around lines 24 - 30, The
setMaxHp method in the Hero class does not enforce the invariant that hp should
never exceed maxHp, and it does not validate that maxHp is a positive value.
Modify the setMaxHp method to first validate that the input value is greater
than zero, then adjust the current hp if it exceeds the new maxHp (by clamping
hp to the new maximum). This ensures the state invariant hp <= maxHp is always
maintained and prevents invalid states where hp exceeds maxHp.
| public PoisonSlime(String suffix) { | ||
| super(suffix); | ||
| this.suffix = suffix; | ||
| } |
There was a problem hiding this comment.
생성자에서 중복 할당 제거 필요
Line 8에서 this.suffix = suffix를 할당하고 있지만, Line 7의 super(suffix)가 이미 부모 클래스의 생성자에서 suffix를 설정합니다. 이 할당은 불필요하며 제거해야 합니다.
🐛 제안된 수정
public PoisonSlime(String suffix) {
super(suffix);
- this.suffix = suffix;
}🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@game/src/main/java/com/survivalcoding/PoisonSlime.java` around lines 6 - 9,
The PoisonSlime constructor is performing a redundant assignment of the suffix
field. The super(suffix) call on line 7 already initializes the suffix field
through the parent class constructor, making the this.suffix = suffix assignment
on line 8 unnecessary. Remove the duplicate assignment statement to eliminate
the redundant code and keep only the super() call in the PoisonSlime
constructor.
|
|
||
| int poisonDamage = hero.getHp() / 5; | ||
| hero.setHp(hero.getHp() - poisonDamage); | ||
| System.out.println(poisonDamage + "point damage"); |
There was a problem hiding this comment.
출력 문자열의 띄어쓰기 누락
poisonDamage와 "point damage" 사이에 공백이 없어 "10point damage" 대신 올바른 형식으로 출력되지 않습니다.
🐛 제안된 수정
- System.out.println(poisonDamage + "point damage");
+ System.out.println(poisonDamage + " point damage");📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| System.out.println(poisonDamage + "point damage"); | |
| System.out.println(poisonDamage + " point damage"); |
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@game/src/main/java/com/survivalcoding/PoisonSlime.java` at line 20, The
System.out.println statement in PoisonSlime.java is missing a space between the
poisonDamage variable and the string literal "point damage". Add a space at the
beginning of the string literal so that the output displays properly (e.g., "10
point damage" instead of "10point damage").
|
|
||
| public class Slime { | ||
| String suffix; | ||
| int hp; |
There was a problem hiding this comment.
사용되지 않는 필드 제거 또는 초기화 필요
hp 필드가 선언되었지만 생성자에서 초기화되지 않고 어떤 메서드에서도 사용되지 않습니다. 필드가 필요하다면 생성자에서 초기화하고 사용하거나, 불필요하다면 제거해야 합니다.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@game/src/main/java/com/survivalcoding/Slime.java` at line 5, The `hp` field
in the Slime class is declared but never initialized in the constructor and is
not used anywhere in the class methods. Either remove the unused `hp` field
entirely if it is not needed, or if the field should be part of the Slime class
functionality, initialize it in the Slime constructor with an appropriate
default value and ensure it is actually used in relevant methods.
|
|
||
|
|
||
| void attack(Hero hero) { | ||
| System.out.println("Slime " + suffix + "attacked"); |
There was a problem hiding this comment.
출력 문자열의 띄어쓰기 누락
suffix와 "attacked" 사이에 공백이 없어 "Slime A attacked" 대신 "Slime Aattacked"로 출력됩니다.
🐛 제안된 수정
- System.out.println("Slime " + suffix + "attacked");
+ System.out.println("Slime " + suffix + " attacked");📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| System.out.println("Slime " + suffix + "attacked"); | |
| System.out.println("Slime " + suffix + " attacked"); |
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@game/src/main/java/com/survivalcoding/Slime.java` at line 13, The
System.out.println statement in the Slime class is missing a space between the
suffix variable and the "attacked" string literal, causing output like "Slime
Aattacked" instead of "Slime A attacked". Add a space before "attacked" in the
concatenated string to fix the formatting issue.
| System.out.println("Slime " + suffix + "attacked"); | ||
| System.out.println("10 point damage"); | ||
|
|
||
| hero.setHp(hero.getHp() - 10); |
There was a problem hiding this comment.
Hero HP가 음수가 될 수 있는 공통 경계 조건 미검증
두 파일 모두에서 Hero의 HP를 감소시킬 때 하한선(0) 검증이 없어 HP가 음수가 될 수 있습니다. 이는 게임 상태의 무결성을 해칠 수 있으므로 모든 데미지 적용 지점에서 HP를 최소 0으로 제한해야 합니다.
game/src/main/java/com/survivalcoding/Slime.java#L16-L16: 기본 공격 데미지(10) 적용 시Math.max(0, newHp)추가game/src/main/java/com/survivalcoding/PoisonSlime.java#L19-L19: 독 데미지 적용 시Math.max(0, newHp)추가
📍 Affects 2 files
game/src/main/java/com/survivalcoding/Slime.java#L16-L16(this comment)game/src/main/java/com/survivalcoding/PoisonSlime.java#L19-L19
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@game/src/main/java/com/survivalcoding/Slime.java` at line 16, The Hero's HP
can become negative when damage is applied, compromising game state integrity.
In game/src/main/java/com/survivalcoding/Slime.java at line 16, modify the
damage calculation in the basic attack (10 damage) by storing the new HP in a
variable and use Math.max(0, newHp) before setting it on the hero to ensure HP
never goes below zero. Apply the same fix in
game/src/main/java/com/survivalcoding/PoisonSlime.java at line 19 for the poison
damage application, using Math.max(0, newHp) to prevent HP from becoming
negative when poison damage is applied.
| @DisplayName("heal prints mana insufficient message when mp is under 10") | ||
| void heal_prints_insufficient_message_when_mp_under_10() { | ||
|
|
||
| Wizard wizard = new Wizard(); | ||
| wizard.setMp(5); | ||
| Hero hero = new Hero(); | ||
| hero.setHp(50); | ||
|
|
||
| wizard.heal(hero); | ||
|
|
||
| assertEquals(50, hero.getHp()); // hp 변화 없음 | ||
| assertEquals(5, wizard.getMp()); // mp 변화 없음 | ||
| } |
There was a problem hiding this comment.
테스트 이름/설명과 실제 검증이 불일치합니다.
현재 테스트는 출력 메시지가 아니라 HP/MP 상태만 검증합니다. DisplayName을 상태 검증 중심으로 바꾸거나, 실제로 stdout 캡처 assertion을 추가해 테스트 의도를 맞춰주세요.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@game/src/test/java/com/survivalcoding/WizardTest.java` around lines 81 - 93,
The test method heal_prints_insufficient_message_when_mp_under_10 has a
DisplayName that indicates it verifies a message is printed, but the actual test
only checks that HP and MP remain unchanged without capturing or asserting any
output. Either update the `@DisplayName` annotation to accurately describe what
the test actually verifies (state preservation when MP is insufficient) or add
stdout capture and assertion to verify that the mana insufficient message is
actually printed to match the test's declared intent.
260616_14_이인준
📝 과제 정보
📋 체크리스트
📷 실행 결과 (또는 테스트 결과)
❓질문 및 어려웠던 점
🔄 자체 평가 & 회고