Ad
  • Custom User Avatar

    Error messages in testFailure is very bad: it doesn't tell what failed and why.

  • Custom User Avatar
  • Default User Avatar

    Hi (I'm the kata author), I had the same issue when I tried to submit my reference solution in 'Train' mode, however there was no error when I submitted the reference solution in kata creation mode. I ended up setting the package org.codewars.kata.dynamicjava for all of the kata classes (test class, solution, and user test class) as well as all of the test cases which seems to have fixed the problem. Try setting that package for your solution and see if you still get that error.

  • Default User Avatar

    Yeah I tried submitting my solution in 'Train' mode and had the same issue (no issue when validating in kata creation mode). I ended up setting a package for all of the classes (test classes and initial code template) which seems to have fixed the issue. Try setting the package org.codewars.kata.dynamicjava for your solution and custom tests and see if that fixes it.

    I changed all of the package names in the code to be compiled in the test cases to org.codewars.kata.dynamicjava as well but playing around a bit with the custom test cases in 'Train' mode no matter what I tried setting the package names to in the code to be compiled it didn't seem to cause any errors. I think the problem only occurs if the test class or solution class uses the default package and you try to load a class with a non-default package name. And this problem only seems to occur in 'Train' mode.

  • Custom User Avatar

    Yeah seems to be something with CodeWars. If I put a package on the unit tests it gets 'stuck' in that package even after removing it.
    For some reason for submitting, if the solution is not in a package it returns;

    Could not find ["my.project.CompilerTest" #<Kind CLASS>] among possibilities: (["CompilerTest" #<Kind CLASS>] 
    

    And when in the package it returns

    /my/project/CompilerTest.java:14: error: cannot find symbol
    Class testClass = DynamicCompiler.compileAndLoad(name,
    ^
    symbol: variable DynamicCompiler
    location: class CompilerTest
    /my/project/CompilerTest.java:31: error: cannot find symbol
    

    Giving an empty class also has the submit report the /my/project path for CompilerTest, seems it's stuck running the test cases out of a different directory.

    Edit: It seems the package stickign only occurs on this kata for me. Tried on another with putting the test cases into a package and all was fine after removing it.
    There was another comment on the forum about this kata and someone else having the same issue.

  • Default User Avatar

    The CompilerTest class does not have a package specified. The my.project package however is used for all of the classes that the test cases try to compile. So for example you might get a call like

    DynamicCompiler.compileAndLoad("my.project.Something", "package my.project; public class Something {}");
    

    Perhaps that is related to the problem you are experincing? Or perhaps there is some issue with the CodeWars website because my reference solution works without those errors.

  • Custom User Avatar

    Looks like the solution test cases are setup with a package name which doesn't allow submiting of the solution;
    /my/project/CompilerTest.java:14: error: cannot find symbol
    Class testClass = DynamicCompiler.compileAndLoad(name,
    ^
    symbol: variable DynamicCompiler
    location: class CompilerTest
    /my/project/CompilerTest.java:31: error: cannot find symbol

  • Default User Avatar

    Very cool. Just trick the test into believing that there are multiple threads... ;-)