Test Specifications and Descriptions for StockInfoManager

StockInfoManager is an entry point to the Sample API. Its getStock method is used to create a StockSymbol object which in turn can be used to retrieve a quote.



public void addQuoteAgent(QuoteAgent agent)

Description

Domain testing of input and output conditions, and external pre-conditions for class StockInfoManager, method public void addQuoteAgent(QuoteAgent agent).

Equivalence Class Partitioning

Pre-conditions agent Expected results Test Case ID
StockInfoManager lookup table is empty some QuoteAgent object StockInfoManager lookup table should contain one reference to agent, this table size should be equal to 1 StockInfoManager2002
StockInfoManager lookup table contains agent some QuoteAgent that was previously added StockInfoManager lookup table should contain at least 1 reference to agent StockInfoManager2002
agent was previously added and then removed from the StockInfoManager lookup table. (This table is not empty) some QuoteAgent object StockInfoManager lookup table should contain at least one reference to agent StockInfoManager2002
null NullPointerException should be thrown StockInfoManager2003

Boundary Value Analysis

Pre-conditions agent Expected results Test Case ID
StockInfoManager lookup table size equal to 1, it contains a reference to agent. some QuoteAgentObject StockInfoManager lookup table should contain at least 1 reference to agent; this table size should be greater than or equal to 1. StockInfoManager2002
StockInfoManager lookup table size equal to 1, it doesn't contain agent. some QuoteAgent object StockInfoManager lookup table should contain at least 1 reference to agent;this table size should be greater than 1. StockInfoManager2002

Assertion testing

Assertion Test Case ID
Adds a QuoteAgent to the StockInfoManager lookup table StockInfoManager2002
If the StockInfoManager lookup table contains a QuoteAgent passed, calling this method has no effect. StockInfoManager2002
NullPointerException - if specified agent is null StockInfoManager2003

Test Descriptions

See:
Test descriptions for AddRemoveTests.java (StockInfoManager2002, StockInfoManager2003)


public static StockInfoManager getDefault()

Description

Domain testing of input and output conditions, and external pre-conditions for class StockInfoManager, method public static StockInfoManager getDefault().

Assertion testing

Pre-conditions Assertion Test Case ID
There have not been the default StockInfoManager set. returns default StockInfoManager (may be null) StockInfoManager2005
Some StockInfoManager (not null) is set. returns default StockInfoManager StockInfoManager2005
null StockInfoManager is set. returns null StockInfoManager2005
Gets the default StockInfoManager. This may be null. StockInfoManager2006

Test Descriptions

Test cases included:
StockInfoManager2005, StockInfoManager2006.

title public static void setDefault(StockInfoManager newDefault) method tests
source SetGetDefTests.java
executeClass com.sun.tdk.sampletck.tests.api.StockInfoManager.SetGetDefTests
executeArgs -serverHost $remote.serverHost -serverPort $remote.serverPort


public java.util.Enumeration getQuoteAgents()

Description

Domain testing of input and output conditions, and external pre-conditions for class StockInfoManager, method public java.util.Enumeration getQuoteAgents().

Equivalence Class Partitioning

Pre-conditions Expected output value Test Case ID
StockInfoManager lookup table is empty empty Enumeration StockInfoManager2007
StockInfoManager lookup table is not empty an enumeration of all installed QuoteAgents in the same order they were added to the StockInfoManager StockInfoManager2007

Boundary Value Analysis

Pre-conditions Expected output value Test Case ID
StockInfoManager lookup table size equals to 1 an enumeration of single QuoteAgent StockInfoManager2007

Assertion testing

Assertion Test Case ID
Gets an enumeration of all installed QuoteAgents in the same order they were added to the StockInfoManager. StockInfoManager2007
removeQuoteAgent(agent) doesn't change the order in lookup table. StockInfoManager2007
addQuoteAgent(agent) doesn't change the order in lookup table. StockInfoManager2007

Test Descriptions

Test cases included:
StockInfoManager2007.

title public java.util.Enumeration getQuoteAgents() method tests
source GetQuoteAgentsTests.java Checker.java
executeClass com.sun.tdk.sampletck.tests.api.StockInfoManager.GetQuoteAgentsTests
executeArgs -serverHost $remote.serverHost -serverPort $remote.serverPort


public StockSymbol getStock(java.lang.String symbol)

Description

Domain testing of input and output conditions, and external pre-conditions for class StockInfoManager, method public StockSymbol getStock(java.lang.String symbol).

Equivalence Class Partitioning

Pre-conditions symbol Expected output value Other expected results Test Case ID
StockInfoManager lookup table contains QuoteAgents that might return requested StockSymbol instance some String requested StockSymbol Returns requested StockSymbol instance through the QuoteAgent installed StockInfoManager0001
StockInfoManager lookup table is empty some String null StockInfoManager0002
StockInfoManager lookup table is empty null NullPointerException StockInfoManager0003
StockInfoManager lookup table isn't empty null NullPointerException StockInfoManager0003

Assertion testing

Assertion Test Case ID
If a particular agent cannot retrieve the symbol due to a GetQuoteException, it is ignored. StockInfoManager2001

Test Descriptions

Test cases included:
StockInfoManager0001, StockInfoManager0002, StockInfoManager0003, StockInfoManager2001.

title public StockSymbol getStock(java.lang.String symbol) distributed tests
source DistributedTests.java
executeClass com.sun.tdk.sampletck.tests.api.StockInfoManager.DistributedTests
executeArgs -serverHost $remote.serverHost -serverPort $remote.serverPort


public void removeQuoteAgent(QuoteAgent agent)

Description

Domain testing of input and output conditions, and external pre-conditions for class StockInfoManager, method public void removeQuoteAgent(QuoteAgent agent).

Equivalence Class Partitioning

Pre-conditions agent Expected results Test Case ID
StockInfoManager lookup table contains agent some QuoteAgent object At least one reference to agent should be removed from StockInfoManager lookup table StockInfoManager2002
StockInfoManager lookup table doesn't contain agent some QuoteAgent object StockInfoManager lookup table is not changed StockInfoManager2002
agent was previously removed and then added from the StockInfoManager's lookup table. (This table is not empty) some QuoteAgent object StockInfoManager lookup table should contain at least one reference to agent StockInfoManager2002
null NullPointerException should be thrown StockInfoManager2004

Boundary Value Analysis

Pre-conditions agent Expected results Test Case ID
StockInfoManager lookup table contains one reference to agent some QuoteAgent object StockInfoManager lookup table should not contain agent. StockInfoManager2002
StockInfoManager lookup table is empty some QuoteAgent object StockInfoManager lookup table is not changed StockInfoManager2002

Assertion testing

Assertion Test Case ID
Removes a QuoteAgent from the StockInfoManager lookup table StockInfoManager2002
If the StockInfoManager lookup table does not contain QuoteAgent passed, calling this method has no effect. StockInfoManager2002
NullPointerException - if agent is null StockInfoManager2004

Test Descriptions

Test cases included:
StockInfoManager2002, StockInfoManager2003, StockInfoManager2004.

title StockInfoManager addQuoteAgent() and removeQuoteAgent() methods tests
source AddRemoveTests.java Checker.java
executeClass com.sun.tdk.sampletck.tests.api.StockInfoManager.AddRemoveTests
executeArgs -serverHost $remote.serverHost -serverPort $remote.serverPort


public static void setDefault(StockInfoManager newDefault)

Description

Domain testing of input and output conditions, and external pre-conditions for class StockInfoManager, method public static void setDefault(StockInfoManager newDefault).

Equivalence Class Partitioning

Pre-conditions newDefault Expected results Test Case ID
There have not been the default StockInfoManager set. StockInfoManager object getDefault() should return newDefault StockInfoManager2005
newDefault is the default StockInfoManager. StockInfoManager object getDefault() should return newDefault StockInfoManager2005
The default StockInfoManager other than newDefault is set. StockInfoManager object getDefault() should return newDefault StockInfoManager2005
null StockInfoManager getDefault() should return null StockInfoManager2006

Assertion testing

Assertion Test Case ID
Sets the default StockInfoManager. StockInfoManager2005
If newDefault is null there will be no default StockInfo StockInfoManager2006

Test Descriptions

See:
Test descriptions for SetGetDefTests.java (StockInfoManager2005, StockInfoManager2006)


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