I tried submitting my solution for the java/simple-cipher exercise last night and today, but both times the test runner failed with the error
An error occurred while running your tests.
This might mean that there was an issue in our infrastructure, or it might mean that you have something in your code that's causing our systems to break.
Please check your code, and if nothing seems to be wrong, try running the tests again.
I then tried to submit the test with the default skeleton code and got the same error
Also I’m not sure if this is related but I can’t view the community solutions for the exercise either, the entire tab is just blank. This issue has been fixed
I ran the java-test-runner manually on the sample implementation and this is the error that is happening:
Exception in thread "main" java.lang.IllegalArgumentException: Multiple entries with same key: TestSource[packageName=, className=SimpleCipherTest, methodName=cipherCanEncode]=@Test
public void cipherCanEncode() {
String plainText = "aaaaaaaaaa";
String cipherText = "abcdefghij";
assertThat(cipherWithDefaultKey.encode(plainText)).isEqualTo(cipherText);
} and TestSource[packageName=, className=SimpleCipherTest, methodName=cipherCanEncode]=/**
* Here we take advantage of the fact that plaintext of "aaa..." doesn't output the key. This is a critical
* problem with shift ciphers, some characters will always output the key verbatim.
*/
@Test
public void cipherCanEncode() {
String plainText = "aaaaaaaaaa";
String cipherText = cipherWithDefaultKey.getKey().substring(0, 10);
assertThat(cipherWithDefaultKey.encode(plainText)).isEqualTo(cipherText);
}
at com.google.common.collect.ImmutableMap.conflictException(ImmutableMap.java:210)
at com.google.common.collect.ImmutableMap.checkNoConflict(ImmutableMap.java:204)
at com.google.common.collect.RegularImmutableMap.checkNoConflictInKeyBucket(RegularImmutableMap.java:146)
at com.google.common.collect.RegularImmutableMap.fromEntryArray(RegularImmutableMap.java:109)
at com.google.common.collect.ImmutableMap$Builder.build(ImmutableMap.java:389)
at com.exercism.junit.JUnitTestParser.buildTestCodeMap(JUnitTestParser.java:51)
at com.exercism.TestRunner.run(TestRunner.java:57)
at com.exercism.TestRunner.main(TestRunner.java:40)
So it turns out the test runner cannot handle nested test classes that well, since the two methods it mentions are defined in separate nested classes.
I was able to spend a little time seeing if this bug is easy to fix, and it looks like it’s going to take some effort to get nested test classes properly supported in the test runner. It’s definitely something I’d like to get fixed at some point, but until then I think the best course of action is not to use nested test classes on the Java track for now.
@Beatzoid you are still welcome to have a stab at fixing the bug in the test runner if you’re up for it, but since it might require some investigation I can imagine that it’s a bit too much to start out with. Would you be willing to pick up the above issue to update the exercise tests instead?