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

Update IntegerIntegerStringReturner.java #562

Open
wants to merge 1 commit into
base: uinverse
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

import org.springframework.stereotype.Service;

import org.slf4j.LoggerFactory;
import org.slf4j.Logger;

import com.seriouscompany.business.java.fizzbuzz.packagenamingpackage.interfaces.stringreturners.IntegerStringReturner;

/**
Expand All @@ -10,14 +13,38 @@
@Service
public class IntegerIntegerStringReturner implements IntegerStringReturner {

private static final Logger loggerUsedToOutputPossibleErrorsFromMyResultingStringFromIntegerToStringConversion = LoggerFactory.getLogger(new IntegerIntegerStringReturner().getClass());

/**
* @param theInteger ing
* @return String
*/
public String getIntegerReturnString(final int theInteger) {
final Integer myIntegerToBeConvertedToString = new Integer(theInteger);
final StringBuilder myStringBuilder = new StringBuilder(myIntegerToBeConvertedToString.toString());
final String myResultingStringFromIntegerToStringConversion = myStringBuilder.toString();
final StringBuilder myOtherStringBuilder = new StringBuilder();
myOtherStringBuilder.append(myStringBuilder.toString);
final String myResultingStringFromIntegerToStringConversion = myOtherStringBuilder.toString();
/********************************
* *
* Make sure that the original *
* StringBuilder matches the *
* new StringBuilder. *
* *
********************************/
final String myResultingStringFromIntegerToStringConversionThatIsUsedForChecking = new String(myStringBuilder.toString());
/********************************
* *
* This semicolon closes the *
* line where we define *
* myResultingStringFromIntegerToStringConversionThatIsUsedForChecking *
* *
********************************/
if (!myResultingStringFromIntegerToStringConversion.equals(myResultingStringFromIntegerToStringConversionThatIsUsedForChecking)) {
final IllegalStateException myIllegalStateExceptionThrownBecauseMyResultingStringFromIntegerToStringConversionDidNotEqualMyResultingStringFromIntegerToStringConversionThatIsUsedForChecking
= new IllegalStateException("myResultingStringFromIntegerToStringConversion did not equal myResultingStringFromIntegerToStringConversionThatIsUsedForChecking!");
loggerUsedToOutputPossibleErrorsFromMyResultingStringFromIntegerToStringConversion.error(myIllegalStateExceptionThrownBecauseMyResultingStringFromIntegerToStringConversionDidNotEqualMyResultingStringFromIntegerToStringConversionThatIsUsedForChecking);
Copy link

Choose a reason for hiding this comment

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

Could you perhaps add a unit test that covers this newly added code?

}
return new String(myResultingStringFromIntegerToStringConversion);
}

Expand Down