[gui-test] ExtendedJTreePathFixture: corrected secondary constructor and its usage

This commit is contained in:
Viktoria.Shirunova
2018-07-10 23:32:36 +03:00
parent c77dfa7f8c
commit 3c0f5f174f
2 changed files with 10 additions and 4 deletions
@@ -23,7 +23,13 @@ open class ExtendedJTreePathFixture(
private val myDriver: ExtendedJTreeDriver = ExtendedJTreeDriver(robot)
) : JTreeFixture(robot, tree) {
constructor(tree: JTree, path: TreePath, predicate: FinderPredicate, robot: Robot, driver: ExtendedJTreeDriver) :
constructor(
tree: JTree,
path: TreePath,
predicate: FinderPredicate = ExtendedJTreePathFinder.predicateEquality,
robot: Robot = GuiRobotHolder.robot,
driver: ExtendedJTreeDriver = ExtendedJTreeDriver(robot)
) :
this(tree, path.path.map { it.toString() }.toList(), predicate, robot, driver)
init {
@@ -767,11 +767,11 @@ object Utils {
fun getJTreePathItemsString(cmp: JTree, path: TreePath): String {
return getJTreePathArray(cmp, path)
.map { StringUtil.wrapWithDoubleQuote(it) }
.reduceRight({ s, s1 -> "$s, $s1" })
.reduceRight { s, s1 -> "$s, $s1" }
}
internal fun getJTreePathArray(tree: JTree, path: TreePath): List<String> = withRobot { robot ->
ExtendedJTreePathFixture(tree, path, robot).getPathStrings()
private fun getJTreePathArray(tree: JTree, path: TreePath): List<String> = withRobot { robot ->
ExtendedJTreePathFixture(tree, path, robot = robot).getPathStrings()
}
fun <ReturnType> withRobot(robotFunction: (Robot) -> ReturnType): ReturnType {