Ad
  • Custom User Avatar

    Thanks LeftofZen, I added your change. I did attempt to swap the assertEquals method's arguments though, as the expected:<[throw towel]> but was:<[42 -9]> was annoying the hell out of me.

    Is it just me or is the Example Test Cases totally untestable in in the Kata editor and even omnitted from the revisions page?
    No wonder so many Katas has broken Example Test Cases.

    PS: Is the Java Test Cases ok? It uses somewhat the same as what the Example Test Cases had.

  • Custom User Avatar

    You need to import junit.Assert if you want to use assert in Java. You also need to fix up the actual assert line to use equals since we are doing a string comparison. Change the default test case to the following:

    import org.junit.Test;
    
    import static junit.framework.TestCase.fail;
    import static org.junit.Assert.*;
    
    public class Tests {
      @Test
      public void Test1() {
        assertEquals(Kata.HighAndLow("8 3 -5 42 -1 0 0 -9 4 7 4 -4"), "42 -9");
      }
    }
    
  • Custom User Avatar

    I don't know Java, so if you can tell me what is wrong I will fix it.

  • Default User Avatar

    What exactly are we wrapping in code tags? For example:

    System.out.println(<code>resultTest</code>);
    or
    <code>System.out.println(resultTest);</code>
    

    These issues with "null" showing up in the most unexpected places of a result are very annoying... Although I guess that is an issue with the CodeWars site as opposed to the kata.

  • Default User Avatar

    I believe I have it figured out (trying with the Java version of this kata), but I keep getting an error with the test case and cannot submit the solution. Error description follows:

    /Tests.java:8: error: cannot find symbol
    assertThat(Kata.HighAndLow("8 3 -5 42 -1 0 0 -9 4 7 4 -4"), is("42 -9"));
    ^
    symbol: method is(String)
    location: class Tests
    1 error
    
    java.lang.RuntimeException: /Tests.java:8: error: cannot find symbol assertThat(Kata.HighAndLow("8 3 -5 42 -1 0 0 -9 4 7 4 -4"), is("42 -9")); ^ symbol: method is(String) location: class Tests 1 error at 		codewars.runners.java$compile_and_load.doInvoke(java.clj:85) at clojure.lang.RestFn.invoke(RestFn.java:439) at codewars.runners.java$fn__572.invoke(java.clj:110) at clojure.lang.MultiFn.invoke(MultiFn.java:227) at codewars.runners$run.invoke(runners.clj:22) at codewars.core$_main$fn__634.invoke(core.clj:40) at clojure.lang.AFn.call(AFn.java:18) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.lang.Thread.run(Thread.java:745) "
    

    It looks to me as if whoever converted this kata over to Java didn't implement the "is(String)" properly, I bet it's an easy fix although I can't be sure.