Created
January 29, 2019 20:00
-
-
Save philwebb/01b6ebfd1f6c65599ae1129fcb8a69b4 to your computer and use it in GitHub Desktop.
Mockito -> BDDMockito
This file contains hidden or 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/sh | |
function migrate { | |
sed -i.bak \ | |
-e 's|import static org.mockito.Mockito.when;|import static org.mockito.BDDMockito.given;|g' \ | |
-e 's|import org.mockito.runners.MockitoJUnitRunner;|import org.mockito.junit.MockitoJUnitRunner;|g' \ | |
-e 's|import org.mockito.Matchers;|import static org.mockito.ArgumentMatchers.*;|g' \ | |
-e 's|import static org.mockito.Mockito.doThrow;|import static org.mockito.BDDMockito.willThrow;|g' \ | |
-e 's|Matchers.any(|any(|g' \ | |
-e 's|doThrow(|willThrow(|g' \ | |
-e 's|||g' \ | |
-e 's|Mockito.when(|when(|g' \ | |
-e 's|when(|given(|g' \ | |
-e 's|.thenReturn(|.willReturn(|g' \ | |
-e 's|.thenThrow(|.willThrow(|g' \ | |
$1 | |
} | |
for folder in `find . -type d | grep src\/test\/java`; do | |
for file in `find $folder -type f -name '*.java'`; do | |
migrate $file | |
done | |
done | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment