You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In the "5. Extract duplicated code" task, submitting this solution fails:
...
fun wordCount(fileName: String): Int {
val file = checkFile(fileName)
var wordCount = 0
file.forEachLine { line ->
wordCount += line.split("\\s+".toRegex()).count()
}
return wordCount
}
private fun checkFile(fileName: String): File {
val file = File(fileName)
if (!file.exists() || !file.isFile) {
throw FileNotFoundException()
}
return file
}
fun copyFile(srcName: String, destName: String) {
val file = checkFile(srcName)
val to = File(destName)
file.copyTo(to)
}
While the err message states: Please, extract the code that checks if the file exists and is valid. I think this solution should also be accepted, or, if you reject the suggestion then, at least, that sentence should be shown in the task description.
The text was updated successfully, but these errors were encountered:
In the "5. Extract duplicated code" task, submitting this solution fails:
While the err message states:
Please, extract the code that checks if the file exists and is valid.
I think this solution should also be accepted, or, if you reject the suggestion then, at least, that sentence should be shown in the task description.The text was updated successfully, but these errors were encountered: