Test Specifications and Descriptions for Quote

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)

Description

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).

Equivalence Class Partitioning

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

Boundary Value Analysis

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 testing

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 Descriptions

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)

Description

Domain testing of input and output conditions, and external pre-conditions for class Quote, method public static java.lang.String convert(int intNum).

Equivalence Class Partitioning

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 testing

Assertion Test Case ID
Convert an int into a String with the decimal placed back in. Quote2008

Test Descriptions

See:
Test descriptions for PublicTests.java (Quote2008)


public int getChange()

Description

Domain testing of input and output conditions, and external pre-conditions for class Quote, method public int getChange().

Assertion testing

Assertion Test Case ID
Return the change in the stock in 1/10000 of a dollar Quote1003

Test Descriptions

See:
Test descriptions for CtorTests.java (Quote1003)


public int getHigh()

Description

Domain testing of input and output conditions, and external pre-conditions for class Quote, method public int getHigh().

Assertion testing

Assertion Test Case ID
Return the 52-week high for the stock Quote1004

Test Descriptions

See:
Test descriptions for CtorTests.java (Quote1004)


public int getLow()

Description

Domain testing of input and output conditions, and external pre-conditions for class Quote, method public int getLow().

Assertion testing

Assertion Test Case ID
Return the 52-week low of the stock Quote1005

Test Descriptions

See:
Test descriptions for CtorTests.java (Quote1005)


public java.lang.String getName()

Description

Domain testing of input and output conditions, and external pre-conditions for class Quote, method public java.lang.String getName().

Assertion testing

Assertion Test Case ID
Return the name of the stock Quote1001

Test Descriptions

See:
Test descriptions for CtorTests.java (Quote1001)


public int getOpen()

Description

Domain testing of input and output conditions, and external pre-conditions for class Quote, method public int getOpen().

Assertion testing

Assertion Test Case ID
Return the opening price of the stock Quote1006

Test Descriptions

See:
Test descriptions for CtorTests.java (Quote1006)


public int getPrevious()

Description

Domain testing of input and output conditions, and external pre-conditions for class Quote, method public int getPrevious().

Assertion testing

Assertion Test Case ID
Return the previous high for the stock Quote1007

Test Descriptions

See:
Test descriptions for CtorTests.java (Quote1007)


public int getPrice()

Description

Domain testing of input and output conditions, and external pre-conditions for class Quote, method public int getPrice().

Assertion testing

Assertion Test Case ID
Return the price of the last trade of the stock Quote1002

Test Descriptions

See:
Test descriptions for CtorTests.java (Quote1002)


public java.lang.String getStringChange()

Description

Domain testing of input and output conditions, and external pre-conditions for class Quote, method public java.lang.String getStringChange().

Assertion testing

Assertion Test Case ID
String representation of change with decimal placed back in the correct spot Quote2003

Test Descriptions

See:
Test descriptions for PublicTests.java (Quote2003)


public java.lang.String getStringHigh()

Description

Domain testing of input and output conditions, and external pre-conditions for class Quote, method public java.lang.String getStringHigh().

Assertion testing

Assertion Test Case ID
String representation of the 52-week high with decimal placed back in the correct spot Quote2004

Test Descriptions

See:
Test descriptions for PublicTests.java (Quote2004)


public java.lang.String getStringLow()

Description

Domain testing of input and output conditions, and external pre-conditions for class Quote, method public java.lang.String getStringLow().

Assertion testing

Assertion Test Case ID
String representation of the 52-week low with decimal placed back in the correct spot Quote2005

Test Descriptions

See:
Test descriptions for PublicTests.java (Quote2005)


public java.lang.String getStringOpen()

Description

Domain testing of input and output conditions, and external pre-conditions for class Quote, method public java.lang.String getStringOpen().

Assertion testing

Assertion Test Case ID
String representation of the opening price with decimal placed back in the correct spot Quote2006

Test Descriptions

See:
Test descriptions for PublicTests.java (Quote2006)


public java.lang.String getStringPrevious()

Description

Domain testing of input and output conditions, and external pre-conditions for class Quote, method public java.lang.String getStringPrevious().

Assertion testing

Assertion Test Case ID
String representation of previous with decimal placed back in the correct spot Quote2007

Test Descriptions

See:
Test descriptions for PublicTests.java (Quote2007)


public java.lang.String getStringPrice()

Description

Domain testing of input and output conditions, and external pre-conditions for class Quote, method public java.lang.String getStringPrice().

Assertion testing

Assertion Test Case ID
String representation of price with decimal placed back in the correct spot Quote2002

Test Descriptions

See:
Test descriptions for PublicTests.java (Quote2002)


public java.util.Date getTime()

Description

Domain testing of input and output conditions, and external pre-conditions for class Quote, method public java.util.Date getTime().

Assertion testing

Assertion Test Case ID
Return the time of the last trade Quote0002

Test Descriptions

See:
Test descriptions for CtorTests.java (Quote0002)


public static int makeInt(java.lang.String source)

Description

Domain testing of input and output conditions, and external pre-conditions for class Quote, method public static int makeInt(java.lang.String source).

Equivalence Class Partitioning

source Expected output value Test Case ID
valid string corresponding integer value Quote2009
null throw NumberFormatException Quote2011
invalid string throw NumberFormatException Quote2012

Assertion testing

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

Test Descriptions

See:
Test descriptions for PublicTests.java (Quote2009, Quote2010, Quote2011, Quote2012)


public java.lang.String toString()

Description

Domain testing of input and output conditions, and external pre-conditions for class Quote, method public java.lang.String toString().

Assertion testing

Assertion Test Case ID
String representation of this quote in the format getName()+" "+getStringPrice()+" at " +getTime()+" "+ getStringChange() Quote2013

Test Descriptions

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


Last updated: 02/02/15
Copyright © 2002 Sun Microsystems, Inc. All rights reserved.
SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.