Skip to content

Commit

Permalink
Remove use of some deprecated functions (#311)
Browse files Browse the repository at this point in the history
Summary: Pull Request resolved: #311

Reviewed By: hick209

Differential Revision: D35794473

Pulled By: strulovich

fbshipit-source-id: 954089c3a824a4da7ba5f506d961199be8a75abd
  • Loading branch information
nreid260 authored and facebook-github-bot committed Apr 25, 2022
1 parent 8f8d12b commit bb66293
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
5 changes: 5 additions & 0 deletions core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,11 @@
<artifactId>kotlin-stdlib-jdk7</artifactId>
<version>${kotlin.version}</version>
</dependency>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-test</artifactId>
<version>${kotlin.version}</version>
</dependency>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-compiler-embeddable</artifactId>
Expand Down
16 changes: 8 additions & 8 deletions core/src/test/java/com/facebook/ktfmt/cli/ParsedArgsTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ import com.google.common.truth.Truth.assertThat
import java.io.ByteArrayOutputStream
import java.io.FileNotFoundException
import java.io.PrintStream
import junit.framework.Assert.fail
import kotlin.io.path.createTempDirectory
import kotlin.test.assertFailsWith
import org.junit.After
import org.junit.Test
import org.junit.runner.RunWith
Expand All @@ -32,7 +33,7 @@ import org.junit.runners.JUnit4
@RunWith(JUnit4::class)
class ParsedArgsTest {

private val root = createTempDir()
private val root = createTempDirectory().toFile()

@After
fun tearDown() {
Expand Down Expand Up @@ -132,12 +133,11 @@ class ParsedArgsTest {
fun `processArgs use the @file option with non existing file`() {
val out = ByteArrayOutputStream()

try {
ParsedArgs.processArgs(PrintStream(out), arrayOf("@non-existing-file"))
fail("expected an exception of type FileNotFoundException but nothing was thrown")
} catch (e: FileNotFoundException) {
assertThat(e.message).contains("non-existing-file (No such file or directory)")
}
val e =
assertFailsWith<FileNotFoundException> {
ParsedArgs.processArgs(PrintStream(out), arrayOf("@non-existing-file"))
}
assertThat(e.message).contains("non-existing-file (No such file or directory)")
}

@Test
Expand Down

0 comments on commit bb66293

Please sign in to comment.