Skip to content

Commit

Permalink
Tuned syntax.
Browse files Browse the repository at this point in the history
  • Loading branch information
alexkrauss committed Aug 16, 2018
1 parent 9e8d32f commit 97682d0
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ Uniformly rename classes, to establish or change some naming conventions:
val refactobot = Refactobot.configure {
refactor {
renameFile("""(.*)DaoBean\.java""", "(.*)DaoImpl.java")
renameFile("""(.*)DaoBean\.java""" to "(.*)DaoImpl.java")
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ class RefactoringContext(originalLocation: FileLocation) {
/**
* DSL element for simple file rename
*/
fun renameFile(regex: String, newName: String) {
fileName = fileName.replace(regex.toRegex(), newName)
fun renameFile(replacement: Pair<String, String>) {
fileName = fileName.replace(replacement.first.toRegex(), replacement.second)
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class ExpanderTest {
val bot = Refactobot.configure {

refactor {
renameFile("(.*)A.java", "$1B.java")
renameFile("(.*)A.java" to "$1B.java")
}

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ class FullIntegrationTest {
val bot = Refactobot.configure {

refactor {
renameFile("InterfaceA.java", "FancyInterface.java")
renameFile("TestClassB.java", "TestClassBar.java")
renameFile("InterfaceA.java" to "FancyInterface.java")
renameFile("TestClassB.java" to "TestClassBar.java")
}

}
Expand Down

0 comments on commit 97682d0

Please sign in to comment.