Skip to content
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

getJobString Refactor - AbstractTest Class #3

Open
icr8FreeCode opened this issue Oct 2, 2023 · 0 comments
Open

getJobString Refactor - AbstractTest Class #3

icr8FreeCode opened this issue Oct 2, 2023 · 0 comments
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@icr8FreeCode
Copy link

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));
     }
}
@icr8FreeCode icr8FreeCode added enhancement New feature or request good first issue Good for newcomers labels Oct 2, 2023
kmccol1 added a commit to kmccol1/techjobs-oo-java-graded-17 that referenced this issue May 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

1 participant