Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Java Introduction to Functional Programming Functional Programming Fundamentals Function Composition

Hugo Hayes
PLUS
Hugo Hayes
Courses Plus Student 13,146 Points

Spanish(Argentina) default currency format doesn't match assertThat(statements, contains(..............

com.teamtreehouse.challenges.homes.MainTest > argentinaRecordsAreFormattedAndConverted FAILED
    java.lang.AssertionError: 
    Expected: iterable containing ["First is $1.00 (USD) which is $15,48 (Argentine Peso)", "Second is $2.00 (USD) which is $30,96 (Argentine Peso)"]
         but: item 0: was "First is $1.00 (USD) which is $ 15,48 (Argentine Peso)"
        at org.hamcrest.MatcherAssert.assertThat(MatcherAssert.java:20)
        at org.junit.Assert.assertThat(Assert.java:865)
        at org.junit.Assert.assertThat(Assert.java:832)
        at com.teamtreehouse.challenges.homes.MainTest.argentinaRecordsAreFormattedAndConverted(MainTest.java:99)

The default Spanish(Argentina) currency format had this wierd space between $ and the number,so I can't pass the prepareSubmission.gradle build. Changing currency format in Windows control panel didn't work. And Yes The Question I post in the actual code challenge section got no response, so I came here.

(P.S I 'm saying wierd space because adding space in the MainTest didn't work)

Nick Frozz
Nick Frozz
31,289 Points

It's ($--> <--15,48) not a "space" it's something called "U+00A0 : NO-BREAK SPACE [NBSP]"

"First is $1.00 (USD) which is $ 15,48 (Argentine Peso)",

"Second is $2.00 (USD) which is $ 30,96 (Argentine Peso)"

2 Answers

To fix, replace the NBSPs with empty strings in the return statement of the argentineCurrencyFormatter function.

return String.format("%s (%s)",
        currencyFormatter.format(price),
        currentCurrency.getDisplayName()
      ).replace("\u00a0","");
Andre Kucharzyk
Andre Kucharzyk
4,479 Points

Is that a bug in the excercise?

Yes. I think it is a bug.