Ad
  • Custom User Avatar

    The parameter order of assertEquals is wrong. The first parameter should be the expected one not the second parameter.

  • Custom User Avatar

    Duplicate ;-)

  • Custom User Avatar

    fix code style to java style instead of c (in java style curved brackets in same line as code block declaration)

  • Custom User Avatar

    add null checking case for tests (if null passed should return empty string)

  • Custom User Avatar

    remove oop tag from this kata because it is about simple string manipulations, not oop

  • Default User Avatar

    Add more test cases incl random test cases.

  • Custom User Avatar

    The test class should be public. the top import was wrong.

  • Custom User Avatar

    Provided test cases don't compile.

  • Custom User Avatar

    Test case syntax errors.
    Missing closing braces in initial solution code.

  • Custom User Avatar

    import org.Junit.Test - must be org.junit.Test

    Testing class must be public

  • Default User Avatar

    Add closing brackets to the initial solution.

  • Default User Avatar

    JAVA:
    The test case class has incorrect code(compile error)!

    replace thetestcase with this code:

    import static org.junit.Assert.*;
    import org.junit.Test;

    public class RobotTest {

    @Test
     public void haha() throws Exception
     {
      Robot obj = new Robot();
      assertEquals(obj.reverse("emma"),"amme");
     }
    
     @Test
     public void hehe()throws Exception
     {
      Robot obj = new Robot();
      assertEquals(obj.reverse("Alphonse"),"esnohplA");
     }
    

    }

  • Custom User Avatar

    I don't even know where to start with this one...

    Issues

    • Missing braces in the setup.

    • Method reverse(String) is static but accessed in a non static way

    • Given tests simply don't work.

    • Add more final tests including random ones

    Solutions

    • Replace the given setup with:
    public class Robot {
      public String reverse(String str) {
        // your awesome code
      }
    }
    
    • Replace the given tests with:
    import static org.junit.Assert.assertEquals;
    
    import org.junit.Test;
    import org.junit.Before;
    import org.junit.After;
    
    public class RobotTest {
      
      Robot obj;
      
      @Before
      public void init() {
        obj = new Robot();
      }
      
      @After
      public void after() {
        obj = null;
      }
      
      @Test
      public void haha() {
        assertEquals(obj.reverse("emma"),"amme");
      }
    
      @Test
      public void hehe() {
        assertEquals(obj.reverse("Alphonse"),"esnohplA");
      }
    }
    
    • Add random tests to the final version.
  • Default User Avatar

    The Test cases were giving weird errors. I submitted and it was rigth.

  • Default User Avatar

    issue is pretty easy, main thing - make tests works

  • Loading more items...