LaunchCodeEducation / LaunchCodeEducation/techjobs-oo-java-graded-17
getJobString Refactor - AbstractTest Class
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 0
- Forks
- 544
- PR merge metrics
- No merged PRs in 30d
Description
Code readability
The following code is hard to read and maintain. It should used functional design with single responsibility principles to clean up the logic and flow of the method calls. Additionally, String.format ( ) can be a function call and abstracted from the getJobString() and called withing each method.
protected String
getJobString (Job job)
throws NoSuchMethodException, ClassNotFoundException,
InvocationTargetException, IllegalAccessException, NoSuchFieldException
{
return String.format ("%nID: %d%n" +
"Name: %s\n" +
"Name: %s%n" +
"Employer: %s\n" +
"Employer: %s%n" +
"Location: %s\n" +
"Location: %s%n" +
"Position Type: %s\n" +
"Position Type: %s%n" +
"Core Competency: %s\n",
getJobId (job),
getJobFieldString (job,"name",true),
getJobFieldString (job,"employer",true),
getJobFieldString (job,"location",true),
"Core Competency: %s%n",getJobId (job),
getJobFieldString (job,"name",true),
getJobFieldString (job,"employer",true),
getJobFieldString (job,"location",true),
getJobFieldString (job,"positionType",true),
getJobFieldString (job, "coreCompetency", true));
getJobFieldString (job, "positionType", true),
getJobFieldString (job, "coreCompetency", true));
}
}
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in the AbstractTest class at getJobString(Job), then inspect the helper methods it calls and the surrounding tests. Refactor the formatting responsibilities as described while preserving the job string output and ensuring the existing tests still pass.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- testing
- Issue type
- Refactor
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100