Skip to content

260616_22_진미#57

Open
MiJin1996 wants to merge 2 commits into
SurvivalCodingCampus:student/22_진미from
MiJin1996:master
Open

260616_22_진미#57
MiJin1996 wants to merge 2 commits into
SurvivalCodingCampus:student/22_진미from
MiJin1996:master

Conversation

@MiJin1996

@MiJin1996 MiJin1996 commented Jun 16, 2026

Copy link
Copy Markdown

260616_22_진미

📝 과제 정보

  • 교육 주제:

📋 체크리스트

  • 코드 컨벤션 준수 (Formatter 적용)
  • 모든 테스트 케이스 통과 (JUnit)

📷 실행 결과 (또는 테스트 결과)

16PoisonSlimeTEST 16Hero 16PoisonSlime 16Slime

❓질문 및 어려웠던 점

🔄 자체 평가 & 회고

  • 이번 과제를 통해 새롭게 알게 된 점이나 아쉬운 점을 기록합니다.

@coderabbitai

coderabbitai Bot commented Jun 16, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@MiJin1996, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 31 minutes and 28 seconds. Learn how PR review limits work.

Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file).

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 083dd57d-c1bc-400b-b939-473360abd03e

📥 Commits

Reviewing files that changed from the base of the PR and between 1507106 and 5092848.

📒 Files selected for processing (1)
  • game/src/test/java/com/survivalcoding/PoisonSlimeTest.java

Walkthrough

Hero, Slime, PoisonSlime 클래스가 새로 추가되어 상속 기반 공격 로직을 구현하였고, JUnit 5 테스트와 PlantUML 다이어그램이 작성되었다. all.java가 제거되었으며, 상속·getter/setter·테스트 코드 관련 TIL 학습 문서가 업데이트되었다.

Changes

게임 클래스 계층 및 테스트 구현

Layer / File(s) Summary
Hero 엔티티 및 PlantUML 다이어그램
game/game.puml, game/src/main/java/com/survivalcoding/Hero.java
Hero 클래스가 hp 필드, 생성자, getter/setter와 함께 추가되고, SuperHero·Hero·wizard 계층을 표현하는 PlantUML 다이어그램이 작성되었다.
Slime/PoisonSlime 상속 구조 구현
game/src/main/java/com/survivalcoding/Slime.java, game/src/main/java/com/survivalcoding/PoisonSlime.java
SlimeHero에게 고정 10 데미지를 가하는 attack() 메서드와 함께 추가되었고, PoisonSlime이 이를 상속하여 poisonCnt 소진 시까지 HP/5 독 데미지를 오버라이드로 구현하였다.
테스트 추가 및 코드 정리
game/src/test/java/com/survivalcoding/PoisonSlimeTest.java, game/src/main/java/com/survivalcoding/PersonPerson.java, game/src/main/java/com/survivalcoding/all.java
PoisonSlimeTest JUnit 5 클래스가 추가되어 attack() 후 Hero HP를 출력 검증하고, all.java 전체가 삭제되었으며 PersonPerson.java에 설명 주석이 추가되었다.

TIL 학습 문서 업데이트

Layer / File(s) Summary
TIL 문서 추가 및 업데이트
TIL/sample/2026-06-15-정리.md, TIL/sample/2026-06-16-정리.md
06-15 문서에 setter 내 IllegalArgumentException 유효성 검사 규칙과 생성자 오버로드 예시가 추가되었고, 06-16 신규 문서에 상속 키워드(extends, super, @Override, final), is-a 원칙, getter/setter 시나리오, 테스트 파일 생성 절차, Cleric 실습 코드 골격이 작성되었다.

🎯 2 (Simple) | ⏱️ ~10 minutes

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Title check ❓ Inconclusive PR 제목이 학생 이름과 과제 번호만 포함하며 실제 변경 내용(상속, Slime 클래스 구현 등)을 명확하게 설명하지 않음. 제목을 '상속: Slime과 PoisonSlime 클래스 구현' 또는 '상속 구현 - Slime/PoisonSlime 클래스' 등으로 변경하여 주요 변경사항을 명확히 나타내세요.
✅ Passed checks (3 passed)
Check name Status Explanation
Description check ✅ Passed PR 설명이 제공된 템플릿 구조를 따르고 있으나, 교육 주제가 비어있으며 질문/어려웠던 점과 자체 평가 섹션의 내용이 미완성 상태입니다.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ 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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 5

🤖 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/game.puml`:
- Line 4: The PlantUML class inheritance syntax has a typo in the SuperHero
class definition where `exdends` should be `extends`. Correct the spelling of
the keyword from `exdends` to `extends` in the class SuperHero declaration to
ensure the inheritance relationship between SuperHero and Hero is properly
parsed by PlantUML.

In `@game/src/main/java/com/survivalcoding/Hero.java`:
- Around line 14-16: The setHp method in the Hero class lacks lower bound
validation, allowing negative HP values that can cause incorrect battle logic
(negative damage becomes healing). Modify the setHp method to validate and clamp
the HP parameter to a minimum value of 0 before assigning it to the instance
variable, or throw an exception if negative values are provided. This ensures HP
state integrity and prevents reversed damage calculations.

In `@game/src/test/java/com/survivalcoding/PoisonSlimeTest.java`:
- Around line 8-15: The attack() test method currently only contains print
statements with no assertions, which means the test will pass regardless of
whether the attack logic works correctly. Add an explicit assertion using
assertEquals to verify the Hero's HP value after the PoisonSlime attacks it.
Based on the comment context, verify that the Hero's HP becomes 72 after being
attacked by the PoisonSlime (starting from 100 HP). Place this assertion after
calling ps.attack(h) and before or instead of the print statements to ensure the
test actually validates the expected behavior.

In `@TIL/sample/2026-06-15-정리.md`:
- Around line 43-46: The constructor overload examples in both TIL documents do
not match the actual Hero.java implementation. In TIL/sample/2026-06-15-정리.md
(lines 43-46), update the Hero constructor examples to reflect the actual
implementation which only includes Hero(int hp), rather than the fictional
Hero(), Hero(String name), and Hero(String name, int hp) constructors. In
TIL/sample/2026-06-16-정리.md (lines 14-17), make the same correction to align
with the actual Hero.java code, or alternatively replace both examples with a
generic constructor overload pattern that is not tied to the actual codebase
implementation to avoid confusion about what exists in the repository.

In `@TIL/sample/2026-06-16-정리.md`:
- Around line 36-44: The instance creation statement Hero hero = new Hero("홍길동",
100); is written at the top level of the class body, which is invalid Java
syntax. Move this instantiation code inside a method (such as a main method)
where executable statements are allowed, or separate it into a different code
example that shows usage outside the class definition. This will ensure the code
sample is syntactically valid and properly demonstrates both the class
definition and its instantiation.
🪄 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: cad2ab24-1d15-42c3-a475-c76647028d76

📥 Commits

Reviewing files that changed from the base of the PR and between adbb3bc and 1507106.

📒 Files selected for processing (9)
  • TIL/sample/2026-06-15-정리.md
  • TIL/sample/2026-06-16-정리.md
  • game/game.puml
  • game/src/main/java/com/survivalcoding/Hero.java
  • game/src/main/java/com/survivalcoding/PersonPerson.java
  • game/src/main/java/com/survivalcoding/PoisonSlime.java
  • game/src/main/java/com/survivalcoding/Slime.java
  • game/src/main/java/com/survivalcoding/all.java
  • game/src/test/java/com/survivalcoding/PoisonSlimeTest.java
💤 Files with no reviewable changes (1)
  • game/src/main/java/com/survivalcoding/all.java

Comment thread game/game.puml
@startuml
scale 3

class SuperHero exdends Hero{

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

extends 키워드 오타로 다이어그램이 깨집니다.

Line 4의 exdendsextends로 수정해야 PlantUML 상속 관계가 정상 파싱됩니다.

🤖 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/game.puml` at line 4, The PlantUML class inheritance syntax has a typo
in the SuperHero class definition where `exdends` should be `extends`. Correct
the spelling of the keyword from `exdends` to `extends` in the class SuperHero
declaration to ensure the inheritance relationship between SuperHero and Hero is
properly parsed by PlantUML.

Comment on lines +14 to +16
public void setHp(int hp) {
this.hp = hp;
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

HP 하한 검증이 없어 전투 로직이 역전될 수 있습니다.

Line 14-16에서 음수 HP를 허용하면, 이후 독 데미지 계산에서 음수 데미지가 발생해 실제로 HP가 증가할 수 있습니다. setHp에서 최소 0으로 clamp(또는 예외 처리)해 상태 무결성을 고정해 주세요.

🤖 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 14 - 16, The
setHp method in the Hero class lacks lower bound validation, allowing negative
HP values that can cause incorrect battle logic (negative damage becomes
healing). Modify the setHp method to validate and clamp the HP parameter to a
minimum value of 0 before assigning it to the instance variable, or throw an
exception if negative values are provided. This ensures HP state integrity and
prevents reversed damage calculations.

Comment thread game/src/test/java/com/survivalcoding/PoisonSlimeTest.java
Comment on lines +43 to +46
[생성자 오버로드] :: 하나의 생성자 + 타입이 다른 여러 방법의 정의 형태
Hero() {}
Hero(String name) {}
Hero(String name, int hp) {}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

생성자 오버로드 예시가 실제 저장소 코드와 불일치합니다.

두 TIL 문서(2026-06-15, 2026-06-16)의 생성자 오버로드 예시는 모두 동일한 근본 원인으로 인한 문제입니다. 제시된 Hero() / Hero(String name) / Hero(String name, int hp) 예시는 현재 저장소의 Hero.java에 존재하지 않으며, 실제 구현은 Hero(int hp) 생성자만 가지고 있습니다. 학습 자료로서 정확성이 중요하므로 두 문서를 모두 수정해 주세요.

  • TIL/sample/2026-06-15-정리.md#L43-L46: 생성자 오버로드 예시를 실제 Hero.java와 일치하도록 수정
  • TIL/sample/2026-06-16-정리.md#L14-L17: 동일하게 예시를 실제 코드와 일치하도록 수정, 또는 더 일반적인 생성자 오버로드 설명으로 변경
📍 Affects 2 files
  • TIL/sample/2026-06-15-정리.md#L43-L46 (this comment)
  • TIL/sample/2026-06-16-정리.md#L14-L17
🤖 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 `@TIL/sample/2026-06-15-정리.md` around lines 43 - 46, The constructor overload
examples in both TIL documents do not match the actual Hero.java implementation.
In TIL/sample/2026-06-15-정리.md (lines 43-46), update the Hero constructor
examples to reflect the actual implementation which only includes Hero(int hp),
rather than the fictional Hero(), Hero(String name), and Hero(String name, int
hp) constructors. In TIL/sample/2026-06-16-정리.md (lines 14-17), make the same
correction to align with the actual Hero.java code, or alternatively replace
both examples with a generic constructor overload pattern that is not tied to
the actual codebase implementation to avoid confusion about what exists in the
repository.

Comment on lines +36 to +44
public class Hero { // ← ①클래스
private String name;
private int hp;
public Hero(String name, int hp) { // ← ②생성자
this.name = name;
this.hp = hp;
}
Hero hero = new Hero("홍길동", 100); // ← ③인스턴스
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

코드 샘플이 문법적으로 유효하지 않습니다.

라인 43의 Hero hero = new Hero("홍길동", 100);는 클래스 본체의 최상위 수준에서 직접 statement를 작성한 것으로, Java 컴파일 오류가 발생합니다. 클래스 변수 선언이나 메소드 내부에서만 인스턴스화 코드가 유효합니다.

🔧 권장 수정안

옵션 1: main 메소드 내부로 이동 (추천)

  public class Hero {
    private String name;
    private int hp;
    public Hero(String name, int hp) {
      this.name = name;
      this.hp = hp;
    }
-   Hero hero = new Hero("홍길동", 100);
+   public static void main(String[] args) {
+     Hero hero = new Hero("홍길동", 100);
+   }
  }

옵션 2: 설명 텍스트로 변경

- Hero hero = new Hero("홍길동", 100);
+ // 인스턴스 생성 예시:
+ // Hero hero = new Hero("홍길동", 100);

옵션 3: 인스턴스 생성을 별도 섹션으로 분리

코드 샘플을 클래스 정의 부분과 사용 부분으로 명확히 분리하면 혼동을 줄일 수 있습니다.

🤖 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 `@TIL/sample/2026-06-16-정리.md` around lines 36 - 44, The instance creation
statement Hero hero = new Hero("홍길동", 100); is written at the top level of the
class body, which is invalid Java syntax. Move this instantiation code inside a
method (such as a main method) where executable statements are allowed, or
separate it into a different code example that shows usage outside the class
definition. This will ensure the code sample is syntactically valid and properly
demonstrates both the class definition and its instantiation.

@junsuk5

junsuk5 commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

test 코드 작성할때 println 말고 assertXXX 함수를 사용해야 합니다

[수정내용]
PoisonSlimeTest 의 println을 assertEquals72, h.getHp());로
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants