The Artima Developer Community


Errata for Programming in Scala
Chapter 14: Assertions and Unit Testing
Return to errata index.

Page 261 (PDF page 291):
line 8 with > which

FIXED
Page 261 (PDF page 291):
l.8 JAR files from with to load
-->                which

FIXED
Page 260 (PDF page 300):
import junit.framework.TestCase
    import junit.framework.Assert.assertEquals
    import junit.framework.Assert.fail
    import Element.elem
    class ElementTestCase extends TestCase {
      def testUniformElement() {
        val ele = elem('x', 2, 3)
        assertEquals(2, ele.width)
        assertEquals(3, ele.height)
        try {
          elem('x', -2, 3)
          fail()
        }
        catch {
          case e: IllegalArgumentException => // expected
        }
      }
    }
The IllegalArgumentException will never be raised(there are no illegal
argument) but // expected comment can make people confused.

Page number: Book type: Paperback book PDF eBook
Book version: (Or build date. Found on back of title page.)
Your feedback:
Your name: (optional)
Your email address: (optional) (will not be published)

Copyright © 2024 Artima, Inc. All rights reserved.