Administrative - PowerPoint PPT Presentation

1 / 7
About This Presentation
Title:

Administrative

Description:

... on the web now, due 5/17. Presentations: Uma on Wednesday, Logan on 5/15. Last time ... source code control / CVS. Read but do not summarize Chapter 2 ... – PowerPoint PPT presentation

Number of Views:78
Avg rating:3.0/5.0
Slides: 8
Provided by: Steve57
Category:

less

Transcript and Presenter's Notes

Title: Administrative


1
05/01
  • Administrative
  • Upcoming due dates
  • group design due 5/8
  • individual Junit assignment on the web now, due
    5/17
  • Presentations Uma on Wednesday, Logan on 5/15
  • Last time
  • look at the video example design diagrams
  • process models
  • traditional
  • RUP
  • spiral and beyond (Jennifer)
  • This time
  • Testing / JUnit Example
  • Next time
  • finish example
  • source code control / CVS
  • Read but do not summarize Chapter 2 (Overview of
    CVS) in this book
  • http//cvsbook.red-bean.com/cvsbook.html

2
All You Really Need to Know to Use JUnit
  • Get the junit.jar file (either from junit.org, or
    from the lab's G drive)
  • Set your class path so it includes both . and
    junit.jar
  • how depends on your IDE directions on the lab's
    "How to" page
  • or you can put junit.jar in your project
    directory
  • To set up a test for your class Thing
  • create a new class ThingTest (name is by
    convention only)
  • import junit.framework.
  • public class ThingTest extends TestCase ...

3
Quick JUnit (cont.)
  • Define a test like this
  • public void testSomething() ...
  • The method must be public, and a void return, and
    no arguments, and the first four characters in
    its name must be "test" but otherwise call it
    what you want
  • Within the body, make the following calls
  • assertTrue(aBooleanExpression)
  • assertFalse(aBooleanExpression)
  • assertEquals(anObject, anotherObject)
  • But DO NOT make a call to
  • assert(aBooleanExpression)
  • why ???

4
Quick JUnit (cont.)
  • Each method is a single test, and often you have
    many of them (so you can tell which one fails).
  • If you want to share objects among your tests, do
    this

protected Thing aThing protected Thing
bThing public void setUp() aThing new
Thing("something") bThing
newThing("else") public void testEquality()
assertFalse(aThing.equals(bThing))
5
To Run Your Test
  • Use the text UI usually when you do that, it's
    embedded in the ThingTest code itself as the main
    method
  • Or run the Swing UI, which is invoked directly
    from the DOS prompt, and type in the name of your
    test class (ThingTest)

import junit.textui. public static void
main(String args) TestRunner.run(new
TestSuite(ThingTest.class))
java cp .junit.jar junit.swingui.TestRunner
6
Our Largish Example
  • We will be manipulating Money, which can get put
    in a CashDrop
  • Money is a (double) amount that is denominated in
    a currency, for example 32.75 USD, 1200 JPY, 15
    EUR
  • two monies can be compared to each other
  • a money can be freely converted from one currency
    to another (but somebody needs to store the
    currency conversion factors)
  • You can put Monies in a CashDrop, which displays
    the number of Monies it has, and the total amount
    of money it has, expressed in its "native
    currency"
  • a CashDrop has a capacity, both in terms of
    number of items, and in terms of total currency
    it can contain
  • you can also "clear" a CashDrop, which empties it
    off all its monies
  • The application should do the "usual" things
    create a money and put it in a CashDrop, display
    a CashDrop, clear a CashDrop

7
Quick Note on Currency Conversion
  • Generally currencies are identified by
    three-character strings
  • but not all three-character strings are currency
    identifiers
  • Convenient to denominate all conversions in USD,
    and store conversion factors only in units of
    (USD/XXX), then to convert YYY to XXX
  • convert YYY to USD
  • convert USD to XXX
  • Some conversion factors as of today
  • 1 JPY .008795 USD
  • 1 EUR 1.2340 USD
  • 1 XAU 500 USD
  • So to convert EUR to XAU
  • 1 EUR 1.2340 USD
  • 1 USD .002 XAU
  • therefore 1 EUR 1.2340 .002 XAU
Write a Comment
User Comments (0)
About PowerShow.com