Skip to content

Commit e0e7df1

Browse files
committed
Improve junit tests to use assertEquals
Using assertTrue and == won't show expected versus result.
1 parent e78456f commit e0e7df1

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

jvm/src/test/scala/scala/xml/XMLTest.scala

+8-8
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@ class XMLTestJVM {
4141
override def text = ""
4242
}
4343

44-
assertTrue(c == parsedxml11)
45-
assertTrue(parsedxml1 == parsedxml11)
44+
assertEquals(c, parsedxml11)
45+
assertEquals(parsedxml1, parsedxml11)
4646
assertTrue(List(parsedxml1) sameElements List(parsedxml11))
4747
assertTrue(Array(parsedxml1).toList sameElements List(parsedxml11))
4848

@@ -51,10 +51,10 @@ class XMLTestJVM {
5151
val i = new InputSource(new StringReader(x2))
5252
val x2p = scala.xml.XML.load(i)
5353

54-
assertTrue(x2p == Elem(null, "book", e, sc,
54+
assertEquals(Elem(null, "book", e, sc,
5555
Elem(null, "author", e, sc, Text("Peter Buneman")),
5656
Elem(null, "author", e, sc, Text("Dan Suciu")),
57-
Elem(null, "title", e, sc, Text("Data on ze web"))))
57+
Elem(null, "title", e, sc, Text("Data on ze web"))), x2p)
5858

5959
}
6060

@@ -455,16 +455,16 @@ class XMLTestJVM {
455455
@UnitTest
456456
def t6939 = {
457457
val foo = <x:foo xmlns:x="http://foo.com/"><x:bar xmlns:x="http://bar.com/"><x:baz/></x:bar></x:foo>
458-
assertTrue(foo.child.head.scope.toString == """ xmlns:x="http://bar.com/"""")
458+
assertEquals(foo.child.head.scope.toString, """ xmlns:x="http://bar.com/"""")
459459

460460
val fooDefault = <foo xmlns="http://foo.com/"><bar xmlns="http://bar.com/"><baz/></bar></foo>
461-
assertTrue(fooDefault.child.head.scope.toString == """ xmlns="http://bar.com/"""")
461+
assertEquals(fooDefault.child.head.scope.toString, """ xmlns="http://bar.com/"""")
462462

463463
val foo2 = scala.xml.XML.loadString("""<x:foo xmlns:x="http://foo.com/"><x:bar xmlns:x="http://bar.com/"><x:baz/></x:bar></x:foo>""")
464-
assertTrue(foo2.child.head.scope.toString == """ xmlns:x="http://bar.com/"""")
464+
assertEquals(foo2.child.head.scope.toString, """ xmlns:x="http://bar.com/"""")
465465

466466
val foo2Default = scala.xml.XML.loadString("""<foo xmlns="http://foo.com/"><bar xmlns="http://bar.com/"><baz/></bar></foo>""")
467-
assertTrue(foo2Default.child.head.scope.toString == """ xmlns="http://bar.com/"""")
467+
assertEquals(foo2Default.child.head.scope.toString, """ xmlns="http://bar.com/"""")
468468
}
469469

470470
@UnitTest

0 commit comments

Comments
 (0)