Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Commented tests in TwoferTest Class and possibly one case missing #728

Closed
ilya-khadykin opened this issue Aug 3, 2017 · 10 comments · Fixed by #733
Closed

Commented tests in TwoferTest Class and possibly one case missing #728

ilya-khadykin opened this issue Aug 3, 2017 · 10 comments · Fixed by #733

Comments

@ilya-khadykin
Copy link
Contributor

While doing two-fer I've noticed that two positive test cases were commented (not sure why).

    @Ignore("Remove to run test")
    @Test
    public void aNameGiven() {
        String input = "Alice";
        String expected = "One for Alice, one for me.";

        assertEquals(expected, twofer.twofer(input));
    }

    @Ignore("Remove to run test")
    @Test
    public void anotherNameGiven() {
        String input = "Bob";
        String expected = "One for Bob, one for me.";

        assertEquals(expected, twofer.twofer(input));
    }

I guess they shouldn't be ignored by default.

Moreover, I suggest adding additional one (but not sure if it complies with task description):

    @Test
    public void emptyStringGiven() {
        String input = "";
        String expected = "One for you, one for me.";

        assertEquals(expected, twofer.twofer(input) );
    }
@Smarticles101
Copy link
Member

The readme for the exercise describes the usage of the @Ignore annotations. They're basically there so that people can work on one test case at a time.

The additional test case you suggested isn't in the canonical data for the exercise but it seems like a good idea to me. Thoughts @exercism/java ?

@stkent
Copy link
Contributor

stkent commented Aug 5, 2017

Interesting, as currently written this depends on how we interpret 'no name':

If no name is given, the result should be "One for you, one for me."

Is a blank string 'no name', or is null the only way to represent 'no name'? 🤔

Could be worth asking in problem-specifications, though i'd be surprised if we get a clear consensus on the above :)

@Smarticles101
Copy link
Member

Smarticles101 commented Aug 7, 2017

The old hello-world exercise used null and/or a blank string to represent no name. The fact that this is different in two-fer suggests that this may have been changed on purpose. Might require some digging to find out.

Update: Didn't take much digging. From exercism/problem-specifications#290 I found that a common opinion seemed to be that null should mean no name given and an empty string should be treated as a valid name

@ilya-khadykin
Copy link
Contributor Author

@Smarticles101, thanks for clarification!

The issue can be closed then.

But in the real life you are expected to deal with empty Strings too 😷

@stkent
Copy link
Contributor

stkent commented Aug 7, 2017

Slightly more specific reference:

Also agreed that if the language can differentiate between empty string and nil, it should probably treat the empty string as a name.

@stkent
Copy link
Contributor

stkent commented Aug 7, 2017

Might still be worth adding a blank string test to the Java track even though it's not captured in the canonical data (since it wouldn't make sense for all languages in the canonical data).

@ilya-khadykin
Copy link
Contributor Author

It's your call, I can create PR if you want and mark this test as with @Ignore("Remove to run test")

@stkent
Copy link
Contributor

stkent commented Aug 7, 2017

I think that'd be a good addition, so yes, please! I'd add it as the last test so it's separated from the 'canonical' tests.

@ilya-khadykin
Copy link
Contributor Author

Sure, will do later today when I get back home

@ilya-khadykin
Copy link
Contributor Author

@stkent, PR #733 has been created, please review 👨‍💻

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants