=====
TODAY WE WILL
=====
*   announcements
*   a few words on JUnit
*   prep for next class

*   You should be working on Homework 10, due by 11:59 pm on
    Friday, December 10th

*   THIS Thursday's Zoom Student Hours will be 3:00 - 5:00 pm
    (instead of their usual 2:00 - 4:00 pm)

*   TODAY: a few words about JUnit, a popular Java unit-testing frameunit

    FRIDAY: December 10th, in lab: Review for FINAL EXAM
    *   there will be clicker questions! Answering those will be
        the Week 15 Lab Exercise!

    *   You should submit any remaining pieces of HOMEWORKS 8, 9, 10
        by FRIDAY, DECEMBER 10th, 11:59 pm

        and then example SOLUTIONS for Homeworks 8 and 9 will be
	posted on Canvas by sometime on SATURDAY, December 11th

    (Note that ALL of the semester's short-answer questions on Canvas
    CAN still be answered -- for FINAL EXAM review purposes -- up until
    3:00 pm on Wednesday, December 15th)

    WEDNESDAY, December 15th - CS 235 Final Exam, 3:00 pm, on Canvas
        (but I will be in BSS 317 if you want to take the Final Exam on
	Canvas from there)

*   you can still send clicker answers (as described in the revised
    syllabus) I am now saying THROUGH 3:00 pm on Wednesday, December 15th
    *   need to email those to me BY THEN (3:00 pm Wednesday Dec 15th)

=====
quickie intro/taste of JUnit!
=====
*   unit testing: writing tests for a "unit" of code --
    what is a unit? In a language like C or C++, it might be a single
        function;

    In a language like Java, it is a method of class (and you'd test a class
        by writing unit tests of all of its methods...)

    *   "Test-First" program development:
        you write the tests for a unit and THEN you write that unit

    *   TDD - test-driven development - takes this even further (more
        "fine-grained", if you will) --
        you write ONE test (within a unit test) for a unit,
	write JUST enough of the unit to pass that test,
	then write another test,
	write JUST enough of the unit to pass that test,
	...and so on
	(hopefully you can see why that's called test-DRIVEN;)

*   JUnit is not part of the "standard" Java API,
    BUT many Java IDEs do include it, and include support for it

    *   want to learn more about it, or about support for it
        in IDEs, one of several nice places to check is:

	junit.org

[ADAPTED from example as:
    https://github.com/junit-team/junit4/wiki/Getting-started ]
*   in our console/command line examples,
    using junit-4.13.2.jar and hamcrest-core-1.3.jar,

    *   compile the class-under-test (Calculator.java, for example)
        as usual:

	for example,
	javac Calculator.java

    *   you can compile the JUnit testing class using:

        javac -cp  .:junit-4.13.2.jar:hamcrest-core-1.3.jar CalculatorTest.java

    *   you can run the JUnit testing class using:

        java -cp .:junit-4.13.2.jar:hamcrest-core-1.3.jar org.junit.runner.JUnitCore CalculatorTest

*   things like @Test and @Before etc. are called ANNOTATIONS!

    The @Before annotation can be used for a method to be run BEFORE each unit test method,
    for set up;

    The @Test annotation signals that the method that follows is a JUnit unit test
    *   ideally, each @Test method tests the functional correctness of ONE method
        in the corresponding Java class
 
*   some more Assert class methods include:
    assertEquals - give it an expression that should be true, and test succeeds if it is

    assertNotSame - asserts (tests succeeds if)
        that two expressions do not refer to the same object

    assertNull - asserts that its expression should be Null

*   IF you have in your current directory:
    *   junit-4.13.2.jar and hamcrest-core-1.3.jar
    *   GameDie.java
    *   GameDieTest.java

    ...you should be able to compile GameDieTest's JUnit tests using:

        javac -cp  .:junit-4.13.2.jar:hamcrest-core-1.3.jar GameDieTest.java

    ...you should be able to execute GameDieTest's JUnit tests using:

        java -cp .:junit-4.13.2.jar:hamcrest-core-1.3.jar org.junit.runner.JUnitCore GameDieTest