Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Convert tests from EasyMock to Mockito
#!/bin/bash
grep -Rl "EasyMock" testsrc | grep -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
You can’t perform that action at this time.