@@ -9,11 +9,8 @@ import io.kotest.matchers.nulls.shouldBeNull
99import io.kotest.matchers.nulls.shouldNotBeNull
1010import io.kotest.matchers.shouldBe
1111import io.kotest.matchers.string.shouldContain
12- import org.apache.commons.io.FileUtils
1312import java.io.File
14-
15-
16- private const val UTF8 = " UTF-8"
13+ import java.nio.charset.StandardCharsets.UTF_8
1714
1815
1916/* *
@@ -43,7 +40,7 @@ class DcmAgentTests : AnnotationSpec() {
4340 fun test_agentmain_file () {
4441 DcmAgent .agentmain(" file $outputFilePath " )
4542
46- val content = FileUtils .readLines(outputFile, UTF8 )
43+ val content = outputFile .readLines(UTF_8 )
4744 content.first() shouldContain " No action in agent argument, do nothing!"
4845 }
4946
@@ -60,7 +57,7 @@ class DcmAgentTests : AnnotationSpec() {
6057
6158 DnsCacheManipulator .getDnsCache(" bing.com" )!! .ip shouldBe " 1.2.3.4"
6259
63- val content = FileUtils .readLines(outputFile, UTF8 )
60+ val content = outputFile .readLines(UTF_8 )
6461 content.last() shouldBe DcmAgent .DCM_AGENT_SUCCESS_MARK_LINE
6562 }
6663
@@ -157,7 +154,7 @@ class DcmAgentTests : AnnotationSpec() {
157154
158155 DnsCacheManipulator .getDnsNegativeCachePolicy() shouldBe 1110
159156
160- val content = FileUtils .readLines(outputFile, UTF8 )
157+ val content = outputFile .readLines(UTF_8 )
161158 content.first() shouldContain " Error to do action setNegativePolicy"
162159 content.first() shouldContain " Action setNegativePolicy need more argument!"
163160 }
@@ -170,7 +167,7 @@ class DcmAgentTests : AnnotationSpec() {
170167
171168 DnsCacheManipulator .getDnsNegativeCachePolicy() shouldBe 1111
172169
173- val content = FileUtils .readLines(outputFile, UTF8 )
170+ val content = outputFile .readLines(UTF_8 )
174171 content.first() shouldContain " Error to do action setNegativePolicy 737 HaHa"
175172 content.first() shouldContain " Too many arguments for action setNegativePolicy! arguments: [737, HaHa]"
176173 }
@@ -179,7 +176,7 @@ class DcmAgentTests : AnnotationSpec() {
179176 fun test_agentmain_unknownAction () {
180177 DcmAgent .agentmain(" unknownAction arg1 arg2 file $outputFilePath " )
181178
182- val content = FileUtils .readLines(outputFile, UTF8 )
179+ val content = outputFile .readLines(UTF_8 )
183180 content.first() shouldContain " No action in agent argument, do nothing!"
184181 }
185182}
0 commit comments