• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Knute Snortum
  • Bear Bibeault
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Ganesh Patekar
Bartenders:
  • Frits Walraven
  • Carey Brown
  • Tim Holloway

Can't get tests to pass for the GeeCON comp programming challenge

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have written a very simple peace of code for this post.
Could anyone please let me know why it is failing as per the output of this test harness?




OUTPUT
+++++++

CodeRanch GeeCON Prague 2014 competition
========================================
{love=1, really=2, coderanch=1, i=1}
Test FAIL
Expected: {love=1, really=2, coderanch=1, i=1}
Actual : null
{never=1, may=1, is=1, better=3, best=2, good=2, rest=1, my=2, until=1, i=1, and=1}
Test FAIL
Expected: {is=1, never=1, may=1, better=3, best=2, good=2, rest=1, my=2, until=1, and=1, i=1}
Actual : null

 
Sheriff
Posts: 4633
300
IntelliJ IDE Clojure Java
  • Likes 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello adam, welcome to the Ranch

I moved your question out of the main competition thread so we could have some discussion about it on the side. Once you have it working and are happy with it then you are more than welcome to submit your new solution to the competition thread again.

Now, back to your question:
You are so very close. Observe that the tests are inspecting the data being returned from the wordOccurrence method, they are not inspecting what is being output with System.out.println. So have a think about what you need to do with wordMap at the end of the method.
 
adam den
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
oh, sorry for so silly mistake!!!

wordOccurrence method should return wordMap;
 
Marshal
Posts: 64667
225
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome again

I presume you will be submitting your corrected version.
 
adam den
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thank you!!!
Regarding posting correct version, i don't think I could win it as per preconditions otherwise i could have tried for it
 
Tim Cooke
Sheriff
Posts: 4633
300
IntelliJ IDE Clojure Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
But by not entering at all you are guaranteeing you won't win. What have you got to lose?

Remember, you can enter more than once if you want to.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!