Created
July 20, 2011 15:38
-
-
Save stefanbirkner/1095194 to your computer and use it in GitHub Desktop.
Convert tests from EasyMock to Mockito
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
fgrep -Rl "EasyMock" testsrc | fgrep -v ".svn" | while read item | |
do | |
sed -i 's/org.easymock.EasyMock.createNiceMock/org.mockito.Mockito.mock/g' $item | |
sed -i 's/org.easymock.EasyMock.createMock/org.mockito.Mockito.mock/g' $item | |
sed -i 's/org.easymock.EasyMock.expect/org.mockito.Mockito.when/g' $item | |
sed -i 's/org.easymock.EasyMock/org.mockito.Mockito/g' $item | |
sed -i 's/EasyMock/Mockito/g' $item | |
sed -i 's/createNiceMock/mock/g' $item | |
sed -i 's/createMock/mock/g' $item | |
sed -i 's/expect(/when(/g' $item | |
sed -i 's/andReturn/thenReturn/g' $item | |
sed -i 's/\.anyTimes()//g' $item | |
sed -i '/replay[^A-Za-z0-9]/d' $item | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
It worked back in the times when I used it. Some manual adjustments may be necessary.