-
Notifications
You must be signed in to change notification settings - Fork 0
adder added #14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
adder added #14
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| package com.coderabbit.app.calculator | ||
|
|
||
| class Adder { | ||
|
|
||
| fun minus(a: Int, b: Int): Int { | ||
| return a - b | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,13 @@ | ||||||
| package com.coderabbit.app.calculator | ||||||
|
|
||||||
| import org.junit.Test | ||||||
|
|
||||||
|
|
||||||
| class AdderTest { | ||||||
|
|
||||||
| @Test | ||||||
| fun `test minus function`() { | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Test naming convention violation. Based on the repository's testing guidelines, test function names should follow the "given (optional) ... when (required) ... then (required)" convention. Apply this diff to fix the naming: - fun `test minus function`() {
+ fun `when subtracting 3 from 5 then returns 2`() {📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||
| val adder = Adder() | ||||||
| assert(adder.minus(5, 3) == 2) | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Use assertEquals for better test reporting. The Apply this diff to improve the assertion: +import org.junit.Assert.assertEquals
+
- assert(adder.minus(5, 3) == 2)
+ assertEquals(2, adder.minus(5, 3))🤖 Prompt for AI Agents |
||||||
| } | ||||||
| } | ||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Critical naming inconsistency: "Adder" class contains subtraction logic.
The class name
Adderstrongly implies addition functionality, but it contains aminusmethod that performs subtraction. This is misleading and will confuse other developers.Consider one of these solutions:
Calculatorclass in the codebase):The second approach maintains architectural consistency with the existing
Calculatorclass that already handlesaddanddivideoperations.🤖 Prompt for AI Agents