Note that there are some explanatory texts on larger screens.

plurals
  1. POUncompilable Source Code: Erroneous Sym Error
    primarykey
    data
    text
    <p>I've been looking at ways to fix this all over the internet and can't really find anything that I understand. I'm doing a tutorial and copying out everything that my teacher has typed, so I'm just learning.. but when I did this it kept giving me this error. Since I'm new to this I have no idea what the heck it means or how to fix it :(</p> <pre><code>public final class DefaultPlayerNameConverter implements PlayerNameConverter { /** * Must be created through the create method. */ private DefaultPlayerNameConverter() { } /** * Create a DefaultPlayerNameConverter. * * @return a DefaultPlayerNameCOnverter. */ public static DefaultPlayerNameConverter create() { final DefaultPlayerNameConverter converter; converter = new DefaultPlayerNameConverter(); return (converter); } /** * Convert player name to remove leading/trailing whitespace. * * @param name the name to convert. * * @return the converted name. * * @throws IllegalArgumentException if name is null. */ @Override public String convertName(final String name) { final String convertedName; if(name == null) { throw new IllegalArgumentException("name cannot be null"); } convertedName = name.trim(); return (convertedName); } } </code></pre> <hr> <pre><code>public class DefaultPlayerNameConverterTest { public DefaultPlayerNameConverterTest() { } /** * Test bad arguments to the convertName method. */ @Test public void testConvertBadName() { try { new DefaultPlayerNameConverter.create().convertName(null); fail("convertName(null) must throw an " + "IllegalArgumentException"); } catch(final IllegalArgumentException ex) { assertEquals("name cannot be null", ex.getMessage()); } } /** * Test good arguments to the convertName method. */ @Test public void testConvertGoodName() { checkConvertName("", ""); checkConvertName("\t", ""); checkConvertName("\n", ""); checkConvertName("\r", ""); checkConvertName("\r\n", ""); checkConvertName("\r\n\t", ""); checkConvertName("X", "X"); checkConvertName(" X", "X"); checkConvertName("X ", "X"); checkConvertName(" X ", "X"); checkConvertName("X Y", "X Y"); checkConvertName("Hello\tworld", "Hello\tworld"); } /** * Check that the name conversion works. * * @param originalName the name to convert. * @param expectedName what the name should be converted to. */ private void checkConvertName(final String originalName, final String expectedName) { final PlayerNameConverter converter; final String convertedName; converter = new DefaultPlayerNameConverter.create(); convertedName = converter.convertName(originalName); assertEquals(expectedName, convertedName); } } </code></pre> <p>The error keeps showing up in my test class when I added the "DefaultPlayerNameConverter create" method. I have no idea how to fix it. I just put what the tutorial told me to do.</p> <hr> <p>This is the PlayerNameConverter interface...</p> <pre><code>public interface PlayerNameConverter { /** * Convert the supplied name. * * @param name the name to convert. * * @return the converted name. */ String convertName(String name); } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload