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

Incorrect usage of verifyNew passes as a green test #271

Closed
johanhaleby opened this issue Jul 24, 2015 · 4 comments
Closed

Incorrect usage of verifyNew passes as a green test #271

johanhaleby opened this issue Jul 24, 2015 · 4 comments

Comments

@johanhaleby
Copy link
Collaborator

From corneliu...@gmail.com on April 01, 2010 13:38:17

hi there,

i tried searching for something similar but couldn't find anything, so here
goes nothing: What steps will reproduce the problem? 1. create a class DirectoryStructure that uses the class File
2. create DirectoryStructureTest that verifies the call to File's constructor
3. do not specify .withArguments(DIRECTORY_PATH) to the
verifyNew(File.class, times(100000)) method What is the expected output? What do you see instead? - the test passes, whereas it should throw some kind of exception to notify
that verifyNew is incorrectly used like mockito does What version of the product are you using? On what operating system? - Power Mockito 1.3.6 Full

  • Windows Xp Please provide any additional information below. - mockito has such a system. you can see what i mean if you remove the
    .mkdirs() from verify(directoryMock).mkdirs() in DirectoryStructureTest @
    line 39

have a good day,
C

Attachment: DirectoryStructure.java DirectoryStructureTest.java

Original issue: http://code.google.com/p/powermock/issues/detail?id=251

@johanhaleby
Copy link
Collaborator Author

From johan.ha...@gmail.com on April 05, 2010 23:47:14

Thanks for reporting this and thanks for a great description of the problem as well as
the examples.

Note: The last verifyNew (verifyNew(File.class, times(1000))) should be
verifyNew(File.class, times(1000)).withArguments(DIRECTORY_PATH);

Status: Accepted
Labels: Milestone-Release1.4

@johanhaleby
Copy link
Collaborator Author

From corneliu...@gmail.com on April 06, 2010 06:43:52

hi,

sure, no problem, i thought they'd be easier to follow, since you originally wrote
them. so the credits for the examples are yours because i only adapted them a bit,
nothing more.

p.s. would it be ok with you if i used your article
( http://blog.jayway.com/2009/10/28/untestable-code-with-mockito-and-powermock/ ) in a
presentation for my colleagues on power mockito?

thanks and cheers,
C

@johanhaleby
Copy link
Collaborator Author

From johan.ha...@gmail.com on April 07, 2010 12:13:44

Sure why not :)

@johanhaleby
Copy link
Collaborator Author

From johan.ha...@gmail.com on April 12, 2010 00:35:33

Fixed in r1292

Status: Fixed

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

No branches or pull requests

1 participant