Ad
  • Default User Avatar

    Well, you can group tests into more test classes. To run it in embedded editor, you can wrap them into one suite, like:

    import org.junit.Test;
    import org.junit.runner.RunWith;
    import org.junit.runners.Suite;
    import static org.hamcrest.CoreMatchers.is;
    import static org.junit.Assert.assertThat;
    
    @RunWith(Suite.class)
    @Suite.SuiteClasses({
       MyTestSuite.MyTests.class,
       MyTestSuite.MyTests2.class
    })
    public class MyTestSuite {   
      
      public static class MyTests {
        @Test public void testIt() {
          assertThat(true, is(true));
        }
      }  
      
      public static class MyTests2 {
        @Test public void testIt2() {
          assertThat(false, is(false));
        }
      }
    }
    
  • Default User Avatar

    FYI: I was able to submit my solution after commenting out my test method

  • Default User Avatar

    It can be done simply by lowering delta:

    assertEquals(5881.25D, Circle.area(43.2673), 0.001);
    

    or by comparing strings:

    assertEquals("5881.25", String.valueOf(Circle.area(43.2673)));
    
  • Default User Avatar

    Null check missing

  • Default User Avatar

    Conversion of array to list is needless here.

  • Default User Avatar

    It's probably bug in codewars (or in some specific library version). You should report it.

    Could you please change the assertion to this form, so we can submit our solutions:

    assertThat(CaffeineBuzz.caffeineBuzz(12), is("CoffeScript"));
    

    Thanks

  • Default User Avatar

    Well the root cause is extra 'e' in your assertion. When I run it outside codewars I get:

    org.junit.ComparisonFailure: 
    Expected :CoffeeScript
    Actual   :CoffeScript
    

    But I don't know, why it doesn't show the correct output here.

    FYI: if you use assertThat notation, it works OK ;)

    assertThat(CaffeineBuzz.caffeineBuzz(12), is("CoffeeScript")); //wrong test with extra 'e'
    
  • Default User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Default User Avatar

    @mcclaskc could you please check your submission tests? This error is really strange.

  • Default User Avatar

    Description upgraded.

  • Default User Avatar

    Well, it's just naming convention (not a standard) that it should be lowerCamelCase.

    Some aged resources are referrenced in http://en.wikipedia.org/wiki/Naming_convention_(programming)#Java and one can find the same convention in the majority of style guides for java repositories - see e.g. Google: https://google-styleguide.googlecode.com/svn/trunk/javaguide.html#s5.2.5-non-constant-field-names

  • Default User Avatar

    Having trouble submitting Java solution. Getting weird empty test result:

    test_caffeineBuzz(CaffeineBuzz_Test)
      expected: but was:
    

    When I add the debug output, the last call of my caffeineBuzz function before the error is with the n = 12.

  • Default User Avatar

    The only unsightly part here is m_... naming convention (not from Java world).

  • Default User Avatar

    Agree with trollingIsAart. This solution is not correct.

  • Default User Avatar

    This solution is not correct - try e.g. squareSum([2, 1, 2])

  • Loading more items...