Skip to content

London | 26-Java-June | Mikiyas Gebremichael | Sprint 3 | Prep exercises - #60

Open
Mikiyas-STP wants to merge 16 commits into
CodeYourFuture:mainfrom
Mikiyas-STP:sprint-3/exercises
Open

Mikiyas-STP wants to merge 16 commits into
CodeYourFuture:mainfrom
Mikiyas-STP:sprint-3/exercises

Conversation

@Mikiyas-STP

@Mikiyas-STP Mikiyas-STP commented Jul 30, 2026 •

Copy link
Copy Markdown

Learners, PR Template

Self checklist

  • I have titled my PR with Region | Cohort | FirstName LastName | Sprint | Assignment Title
  • My changes meet the requirements of the task
  • I have tested my changes
  • My changes follow the style guide

Changelist

Briefly explain your PR.

Questions

Ask any questions you have for your reviewer. You must remove this section if you have no questions.

@Mikiyas-STP Mikiyas-STP added 📅 Sprint 3 Assigned during Sprint 3 of this module Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. labels Jul 30, 2026
@jacknewman1995 jacknewman1995 self-assigned this Aug 4, 2026

@jacknewman1995 jacknewman1995 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.

Looks good - avoid classnames like "new" and try to name classes according to the real objects the represent.

return a\ * b;
}

public int divide(int a, int b) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Should there be a square root method in here too?

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Ah you've got it in a separate file, how come?

@BeforeEach
void setUp() {
calculator = new Calculator();
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

You don't need the before each here - junit creates a new instance of the test class when each test method is run, so you can just instantiate as a new private field

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This is not a good class name - class names should indicate the object represented by the class.

public class CalculatorNew {

public int add(int a, int b) {
return a + b;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Why have we duplicated all this code?

}

public List<String> splitCommaSeparatedLine(String s) {
return Arrays.asList(s.split(","));

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Nice

@ParameterizedTest(name = "\"{0}\" should return {1}")
@CsvSource({
"level, true",
"racecar, true",a

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

What's the extra a doing here?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. Review in progress 📅 Sprint 3 Assigned during Sprint 3 of this module

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants