Skip to content

Commit

Permalink
Improve junit tests to use assertEquals
Browse files Browse the repository at this point in the history
Using assertTrue and == won't show expected versus result.
  • Loading branch information
ashawley committed Apr 18, 2019
1 parent e78456f commit e0e7df1
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions jvm/src/test/scala/scala/xml/XMLTest.scala
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ class XMLTestJVM {
override def text = ""
}

assertTrue(c == parsedxml11)
assertTrue(parsedxml1 == parsedxml11)
assertEquals(c, parsedxml11)
assertEquals(parsedxml1, parsedxml11)
assertTrue(List(parsedxml1) sameElements List(parsedxml11))
assertTrue(Array(parsedxml1).toList sameElements List(parsedxml11))

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

assertTrue(x2p == Elem(null, "book", e, sc,
assertEquals(Elem(null, "book", e, sc,
Elem(null, "author", e, sc, Text("Peter Buneman")),
Elem(null, "author", e, sc, Text("Dan Suciu")),
Elem(null, "title", e, sc, Text("Data on ze web"))))
Elem(null, "title", e, sc, Text("Data on ze web"))), x2p)

}

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

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

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>""")
assertTrue(foo2.child.head.scope.toString == """ xmlns:x="http://bar.com/"""")
assertEquals(foo2.child.head.scope.toString, """ xmlns:x="http://bar.com/"""")

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

@UnitTest
Expand Down

0 comments on commit e0e7df1

Please sign in to comment.