Stock quote object. Used to represent (immutable) stock quote.
public Quote(java.lang.String name, java.util.Date time, int price, int change, int high, int low, int open, int prev)
public static java.lang.String convert(int intNum)
public int getChange()
public int getHigh()
public int getLow()
public java.lang.String getName()
public int getOpen()
public int getPrevious()
public int getPrice()
public java.lang.String getStringChange()
public java.lang.String getStringHigh()
public java.lang.String getStringLow()
public java.lang.String getStringOpen()
public java.lang.String getStringPrevious()
public java.lang.String getStringPrice()
public java.util.Date getTime()
public static int makeInt(java.lang.String source)
public java.lang.String toString()
public Quote(java.lang.String name, java.util.Date time, int price, int change, int high, int low, int open, int prev)
Domain testing of input and output conditions, and external
pre-conditions for class Quote,
constructor public Quote(java.lang.String name, java.util.Date time, int price, int change, int high, int low, int open, int prev)
.
name | time | price | change | high | low | open | prev | Expected results | Test Case ID |
---|---|---|---|---|---|---|---|---|---|
valid string | valid Date object | valid | valid | valid | valid | valid | valid | Creates a new Quote object. | Quote2001 |
null | valid Date object | valid | valid | valid | valid | valid | valid | Will throw NullPointerException | Quote0001 |
valid string | null | valid | valid | valid | valid | valid | valid | Will create an instance of Quote | Quote0002 |
valid string | valid Date object | negative | valid | valid | valid | valid | valid | Creates a new Quote object. | Quote1002 |
valid string | valid Date object | zero | valid | valid | valid | valid | valid | Creates a new Quote object. | Quote1002 |
valid string | valid Date object | positive | valid | valid | valid | valid | valid | Creates a new Quote object. | Quote1002 |
valid string | valid Date object | valid | negative | valid | valid | valid | valid | Creates a new Quote object. | Quote1003 |
valid string | valid Date object | valid | zero | valid | valid | valid | valid | Creates a new Quote object. | Quote1003 |
valid string | valid Date object | valid | positive | valid | valid | valid | valid | Creates a new Quote object. | Quote1003 |
valid string | valid Date object | valid | valid | negative | valid | valid | valid | Creates a new Quote object. | Quote1004 |
valid string | valid Date object | valid | valid | zero | valid | valid | valid | Creates a new Quote object. | Quote1004 |
valid string | valid Date object | valid | valid | positive | valid | valid | valid | Creates a new Quote object. | Quote1004 |
valid string | valid Date object | valid | valid | valid | negative | valid | valid | Creates a new Quote object. | Quote1005 |
valid string | valid Date object | valid | valid | valid | zero | valid | valid | Creates a new Quote object. | Quote1005 |
valid string | valid Date object | valid | valid | valid | positive | valid | valid | Creates a new Quote object. | Quote1005 |
valid string | valid Date object | valid | valid | valid | valid | negative | valid | Creates a new Quote object. | Quote1006 |
valid string | valid Date object | valid | valid | valid | valid | zero | valid | Creates a new Quote object. | Quote1006 |
valid string | valid Date object | valid | valid | valid | valid | positive | valid | Creates a new Quote object. | Quote1006 |
valid string | valid Date object | valid | valid | valid | valid | valid | negative | Creates a new Quote object. | Quote1007 |
valid string | valid Date object | valid | valid | valid | valid | valid | zero | Creates a new Quote object. | Quote1007 |
valid string | valid Date object | valid | valid | valid | valid | valid | positive | Creates a new Quote object. | Quote1007 |
name | time | price | change | high | low | open | prev | Expected results | Test Case ID |
---|---|---|---|---|---|---|---|---|---|
empty string, string of length 1 | Creates a new Quote object. | Quote1001 | |||||||
Integer.MIN_VALUE, Integer.MIN_VALUE+1, -1, 0, 1, Integer.MAX_VALUE-1, Integer.MAX_VALUE | Will create an instance of Quote | Quote1002 | |||||||
Integer.MIN_VALUE, Integer.MIN_VALUE+1, -1, 0, 1, Integer.MAX_VALUE-1, Integer.MAX_VALUE | Will create an instance of Quote | Quote1003 | |||||||
Integer.MIN_VALUE, Integer.MIN_VALUE+1, -1, 0, 1, Integer.MAX_VALUE-1, Integer.MAX_VALUE | Will create an instance of Quote | Quote1004 | |||||||
Integer.MIN_VALUE, Integer.MIN_VALUE+1, -1, 0, 1, Integer.MAX_VALUE-1, Integer.MAX_VALUE | Will create an instance of Quote | Quote1005 | |||||||
Integer.MIN_VALUE, Integer.MIN_VALUE+1, -1, 0, 1, Integer.MAX_VALUE-1, Integer.MAX_VALUE | Will create an instance of Quote | Quote1006 | |||||||
Integer.MIN_VALUE, Integer.MIN_VALUE+1, -1, 0, 1, Integer.MAX_VALUE-1, Integer.MAX_VALUE | Will create an instance of Quote | Quote1007 |
Assertion | Test Case ID |
---|---|
Creates a new Quote object. | Quote2001 |
Throws: NullPointerException - if the specified name is null | Quote0001 |
Argument time can be null. | Quote0002 |
Test cases included:
Quote2001,
Quote1001,
Quote0001,
Quote0002,
Quote1002,
Quote1003,
Quote1004,
Quote1005,
Quote1006,
Quote1007.
title | Quote constructor tests |
source | CtorTests.java |
executeClass | com.sun.tdk.sampletck.tests.api.Quote.CtorTests |
public static java.lang.String convert(int intNum)
Domain testing of input and output conditions, and external
pre-conditions for class Quote,
method public static java.lang.String convert(int intNum)
.
intNum | Expected output value | Test Case ID |
---|---|---|
negative | string representation for intNum | Quote2008 |
zero | string representation for intNum | Quote2008 |
positive | string representation for intNum | Quote2008 |
Assertion | Test Case ID |
---|---|
Convert an int into a String with the decimal placed back in. | Quote2008 |
public int getChange()
Domain testing of input and output conditions, and external
pre-conditions for class Quote,
method public int getChange()
.
Assertion | Test Case ID |
---|---|
Return the change in the stock in 1/10000 of a dollar | Quote1003 |
public int getHigh()
Domain testing of input and output conditions, and external
pre-conditions for class Quote,
method public int getHigh()
.
Assertion | Test Case ID |
---|---|
Return the 52-week high for the stock | Quote1004 |
public int getLow()
Domain testing of input and output conditions, and external
pre-conditions for class Quote,
method public int getLow()
.
Assertion | Test Case ID |
---|---|
Return the 52-week low of the stock | Quote1005 |
public java.lang.String getName()
Domain testing of input and output conditions, and external
pre-conditions for class Quote,
method public java.lang.String getName()
.
Assertion | Test Case ID |
---|---|
Return the name of the stock | Quote1001 |
public int getOpen()
Domain testing of input and output conditions, and external
pre-conditions for class Quote,
method public int getOpen()
.
Assertion | Test Case ID |
---|---|
Return the opening price of the stock | Quote1006 |
public int getPrevious()
Domain testing of input and output conditions, and external
pre-conditions for class Quote,
method public int getPrevious()
.
Assertion | Test Case ID |
---|---|
Return the previous high for the stock | Quote1007 |
public int getPrice()
Domain testing of input and output conditions, and external
pre-conditions for class Quote,
method public int getPrice()
.
Assertion | Test Case ID |
---|---|
Return the price of the last trade of the stock | Quote1002 |
public java.lang.String getStringChange()
Domain testing of input and output conditions, and external
pre-conditions for class Quote,
method public java.lang.String getStringChange()
.
Assertion | Test Case ID |
---|---|
String representation of change with decimal placed back in the correct spot | Quote2003 |
public java.lang.String getStringHigh()
Domain testing of input and output conditions, and external
pre-conditions for class Quote,
method public java.lang.String getStringHigh()
.
Assertion | Test Case ID |
---|---|
String representation of the 52-week high with decimal placed back in the correct spot | Quote2004 |
public java.lang.String getStringLow()
Domain testing of input and output conditions, and external
pre-conditions for class Quote,
method public java.lang.String getStringLow()
.
Assertion | Test Case ID |
---|---|
String representation of the 52-week low with decimal placed back in the correct spot | Quote2005 |
public java.lang.String getStringOpen()
Domain testing of input and output conditions, and external
pre-conditions for class Quote,
method public java.lang.String getStringOpen()
.
Assertion | Test Case ID |
---|---|
String representation of the opening price with decimal placed back in the correct spot | Quote2006 |
public java.lang.String getStringPrevious()
Domain testing of input and output conditions, and external
pre-conditions for class Quote,
method public java.lang.String getStringPrevious()
.
Assertion | Test Case ID |
---|---|
String representation of previous with decimal placed back in the correct spot | Quote2007 |
public java.lang.String getStringPrice()
Domain testing of input and output conditions, and external
pre-conditions for class Quote,
method public java.lang.String getStringPrice()
.
Assertion | Test Case ID |
---|---|
String representation of price with decimal placed back in the correct spot | Quote2002 |
public java.util.Date getTime()
Domain testing of input and output conditions, and external
pre-conditions for class Quote,
method public java.util.Date getTime()
.
Assertion | Test Case ID |
---|---|
Return the time of the last trade | Quote0002 |
public static int makeInt(java.lang.String source)
Domain testing of input and output conditions, and external
pre-conditions for class Quote,
method public static int makeInt(java.lang.String source)
.
source | Expected output value | Test Case ID |
---|---|---|
valid string | corresponding integer value | Quote2009 |
null | throw NumberFormatException | Quote2011 |
invalid string | throw NumberFormatException | Quote2012 |
Assertion | Test Case ID |
---|---|
Take a String representation of a floating point number and make an int out of it. | Quote2009 |
Looking at a maximum of 4 fractional places (trim exceeding) | Quote2010 |
throws java.lang.NumberFormatException - if the source is null or after applying specified operations does not represent a valid int | Quote2011 |
throws java.lang.NumberFormatException - if the source is null or after applying specified operations does not represent a valid int | Quote2012 |
public java.lang.String toString()
Domain testing of input and output conditions, and external
pre-conditions for class Quote,
method public java.lang.String toString()
.
Assertion | Test Case ID |
---|---|
String representation of this quote in the format getName()+" "+getStringPrice()+" at " +getTime()+" "+ getStringChange() | Quote2013 |
Test cases included:
Quote2002,
Quote2003,
Quote2004,
Quote2005,
Quote2006,
Quote2007,
Quote2008,
Quote2009,
Quote2010,
Quote2011,
Quote2012,
Quote2013.
title | Quote public methods tests |
source | PublicTests.java |
executeClass | com.sun.tdk.sampletck.tests.api.Quote.PublicTests |