Skip to content

GitLab

  • Menu
    • Projects Groups Snippets
      Help
Projects Groups Snippets
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Sign in
  • P project02
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 0
    • Issues 0
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 0
    • Merge requests 0
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • cs2-19wi
  • project02
  • Issues
  • #3

Closed
Open
Created 6 years ago by Ethan Ordentlich@eordentlDeveloper
  • New issue

  • Report abuse

  • New issue

  • Report abuse

Test Issues

Closed

Test Issues

Another once-over, and more problems found:

  • testExceptionsViolatedInRandomConstructor and testExceptionsViolatedInEvilConstructor do not match the spec.
assertThrows(IllegalStateException.class, () -> Reflection.newInstance(c, -1, 3));

should throw an IllegalArgumentxception by the spec, since wordLength < 1. A more appropriate additional test would be

assertThrows(IllegalStateException.class, () -> Reflection.newInstance(c, Integer.MAX_VALUE, 3));
  • The spec currently expects IllegalStateExceptions due to an empty wordlist to be thrown in the makeGuess method. The tests expect them to be thrown in the constructor. Either the spec or the tests should be corrected for consistency.

  • testMakeGuessExceptionsInRandom is not mentioned in the spec, instead stated as an assumption. I suggest changing the part about assuming valid inputs to something about making sure to validate their inputs and throw an appropriate exception if the input is not valid.

  • testMakeGuessExceptionsInRandom does not test what it is supposed to test. I don't know what Reflection.getMethod() tries to pass in for the constructor, but it isn't a valid argument for the attributes, so it triggers the IllegalAttributeException of the constructor. Not sure what best practice is in this case - @blank?

  • The trace tests appear to be correct at this point, no further changes needed here.

Edited 6 years ago
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information

Linked issues
0


  • Ethan Ordentlich @eordentl changed the description 6 years ago

    changed the description

  • Ethan Ordentlich
    Ethan Ordentlich @eordentl · 6 years ago
    Author Developer

    @blank @jkarras

  • Adam Blank
    Adam Blank @blank · 6 years ago
    Owner

    testExceptionsViolatedInRandomConstructor and testExceptionsViolatedInEvilConstructor do not match the spec. -- agreed, fixed.

    The spec currently expects IllegalStateExceptions due to an empty wordlist to be thrown in the makeGuess method. The tests expect them to be thrown in the constructor. Either the spec or the tests should be corrected for consistency. -- agreed @jkarras please fix

    testMakeGuessExceptionsInRandom is not mentioned in the spec, instead stated as an assumption. I suggest changing the part about assuming valid inputs to something about making sure to validate their inputs and throw an appropriate exception if the input is not valid. -- agreed @jkarras please fix

    testMakeGuessExceptionsInRandom does not test what it is supposed to test. I don't know what Reflection.getMethod() tries to pass in for the constructor, but it isn't a valid argument for the attributes, so it triggers the IllegalAttributeException of the constructor. Not sure what best practice is in this case -- this should be fixed now, but I didn't have time right now to actually test it; so, @eordentl please let me know

  • Johanna S. Karras
    Johanna S. Karras @jkarras · 6 years ago
    Developer

    The spec should be fixed now!

  • Ethan Ordentlich
    Ethan Ordentlich @eordentl · 6 years ago
    Author Developer

    @blank

    Worked out how to fix the testMakeGuessExceptionsInRandom and testMakeGuessExceptionsInEvil - the IllegalArgumentException is being thrown because the target object is in the wrong place and because the guess needs to be cast back to a char. Correct code is

    IntStream.range(0, 20).forEach(i -> assertThrows(IllegalArgumentException.class, () -> m.invoke(chooser, (char) ('a' - (i + 1)))));
    IntStream.range(0, 20).forEach(i -> assertThrows(IllegalArgumentException.class, () -> m.invoke(chooser, (char) ('z' + (i + 1)))));

    Also:

    • Test doesn't check for IllegalStateException due to an empty wordlist. In the constructor exception tests, add
    assertThrows(IllegalStateException.class, () -> Reflection.newInstance(c, Integer.MAX_VALUE, 3));
    • I'm really not sure how I missed this, but GuesserTests has the tests for the choosers, and ChooserTests has the tests for the guesser.
  • Adam Blank
    Adam Blank @blank · 6 years ago
    Owner

    @jkarras

  • Adam Blank
    Adam Blank @blank · 6 years ago
    Owner

    @jkarras are these all fixed now? if so, please close this issue

  • Johanna S. Karras @jkarras closed 6 years ago

    closed

  • You're only seeing other activity in the feed. To add a comment, switch to one of the following options.
Please register or sign in to reply
0 Assignees
Assign to
Milestone
No milestone
None
None
Time tracking
Due date
None
None
Labels
0
None
0
None
    Assign labels
  • Manage project labels

Confidentiality
Not confidential

You are going to turn on confidentiality. Only team members with at least Reporter access will be able to see and leave comments on the issue.

Lock issue
Unlocked
participants
Reference:

Menu

Projects Groups Snippets
Help