@@ -2,8 +2,8 @@ package scala.xml
22
33import org .junit .{Test => UnitTest }
44import org .junit .Assert .{assertEquals , assertFalse , assertNull , assertThrows , assertTrue }
5- import java .io .StringWriter
6- import java . io . ByteArrayOutputStream
5+ import java .io .{ ByteArrayInputStream , ByteArrayOutputStream , InputStreamReader , IOException , ObjectInputStream ,
6+ ObjectOutputStream , OutputStreamWriter , PrintStream , StringWriter }
77import java .net .URL
88import scala .xml .dtd .{DocType , PublicID }
99import scala .xml .parsing .ConstructingParser
@@ -177,26 +177,26 @@ class XMLTestJVM {
177177 </entry>""" , f(" a,b,c" ).toString)
178178
179179 object Serialize {
180- @ throws(classOf [java.io. IOException ])
180+ @ throws(classOf [IOException ])
181181 def write [A ](o : A ): Array [Byte ] = {
182182 val ba : ByteArrayOutputStream = new ByteArrayOutputStream (512 )
183- val out : java.io. ObjectOutputStream = new java.io. ObjectOutputStream (ba)
183+ val out : ObjectOutputStream = new ObjectOutputStream (ba)
184184 out.writeObject(o)
185185 out.close()
186186 ba.toByteArray
187187 }
188- @ throws(classOf [java.io. IOException ])
188+ @ throws(classOf [IOException ])
189189 @ throws(classOf [ClassNotFoundException ])
190190 def read [A ](buffer : Array [Byte ]): A = {
191- val in : java.io. ObjectInputStream =
192- new java.io. ObjectInputStream (new java.io. ByteArrayInputStream (buffer))
191+ val in : ObjectInputStream =
192+ new ObjectInputStream (new ByteArrayInputStream (buffer))
193193 in.readObject().asInstanceOf [A ]
194194 }
195195 def check [A , B ](x : A , y : B ): Unit = {
196196 // println("x = " + x)
197197 // println("y = " + y)
198- // println("x equals y: " + (x equals y) + ", y equals x: " + (y equals x))
199- assertTrue(x.equals(y) && y.equals(x) )
198+ // println("x == y: " + (x == y) + ", y == x: " + (y == x))
199+ assertTrue(x == y && y == x )
200200 // println()
201201 }
202202 }
@@ -296,14 +296,14 @@ class XMLTestJVM {
296296 // scala.xml.XML.save("foo.xml", xml)
297297 // scala.xml.XML.loadFile("foo.xml").toString
298298
299- val outputStream : java.io. ByteArrayOutputStream = new java.io. ByteArrayOutputStream
300- val streamWriter : java.io. OutputStreamWriter = new java.io. OutputStreamWriter (outputStream, " UTF-8" )
299+ val outputStream : ByteArrayOutputStream = new ByteArrayOutputStream
300+ val streamWriter : OutputStreamWriter = new OutputStreamWriter (outputStream, " UTF-8" )
301301
302302 XML .write(streamWriter, xml, XML .encoding, xmlDecl = false , null )
303303 streamWriter.flush()
304304
305- val inputStream : java.io. ByteArrayInputStream = new java.io. ByteArrayInputStream (outputStream.toByteArray)
306- val streamReader : java.io. InputStreamReader = new java.io. InputStreamReader (inputStream, XML .encoding)
305+ val inputStream : ByteArrayInputStream = new ByteArrayInputStream (outputStream.toByteArray)
306+ val streamReader : InputStreamReader = new InputStreamReader (inputStream, XML .encoding)
307307
308308 assertEquals(xml.toString, XML .load(streamReader).toString)
309309 }
@@ -492,8 +492,6 @@ class XMLTestJVM {
492492
493493 @ UnitTest
494494 def dontLoop (): Unit = {
495- import java .io .{ Console => _ , _ }
496-
497495 val xml : String = " <!DOCTYPE xmeml SYSTEM 'uri'> <xmeml> <sequence> </sequence> </xmeml> "
498496 val sink : PrintStream = new PrintStream (new ByteArrayOutputStream ())
499497 Console .withOut(sink) {
@@ -1026,7 +1024,7 @@ class XMLTestJVM {
10261024
10271025 def toSource (s : String ): scala.io.Source = new scala.io.Source {
10281026 override val iter : Iterator [Char ] = s.iterator
1029- override def reportError (pos : Int , msg : String , out : java.io. PrintStream = Console .err): Unit = ()
1027+ override def reportError (pos : Int , msg : String , out : PrintStream = Console .err): Unit = ()
10301028 }
10311029
10321030 @ UnitTest
0 commit comments