|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.echarts.test.sip.CATMatchers
public class CATMatchers
This class is a holder for static factory methods for instantiating
matchers in KitCAT. To access these methods without qualification,
a test case can import these methods statically by including the
following static import
statement.
import static org.echarts.test.sip.CATMatchers.*;
Method Summary | ||
---|---|---|
static org.hamcrest.Matcher<SIPAgent> |
blackHoleSDP()
Factory method to create a matcher to check whether agent has current SDP with "black-hole" connection address (0.0.0.0) |
|
static org.hamcrest.Matcher<SIPAgent> |
connected()
Factory method to create a matcher to check whether an agent is in a SIP dialog. |
|
static org.hamcrest.Matcher<SIPAgent> |
connectedTo(SIPAgent peerAgent)
Factory method to create a matcher to check whether an agent is connected to another agent. |
|
static org.hamcrest.Matcher<SIPAgent> |
disconnected()
Factory method to create a matcher to check whether an agent has terminated its SIP dialog. |
|
static
|
has(org.hamcrest.Matcher<T> matcher)
Syntactic sugar to improve readability. |
|
static org.hamcrest.Matcher<SIPAgent> |
idle()
Factory method to create a matcher to check whether the current state of an agent is idle. |
|
static org.hamcrest.Matcher<SIPAgent> |
incomingMedia()
Factory method to create a matcher to check whether agent has RTP packets in its media buffer. |
|
static org.hamcrest.Matcher<SIPAgent> |
inState(BaseState expectedState)
Factory method for matcher to check whether agent is in a specific state. |
|
static org.hamcrest.Matcher<SIPAgent> |
invited()
Factory method to create a matcher to check whether an agent is in a state where it has received an INVITE. |
|
static
|
no(org.hamcrest.Matcher<T> matcher)
Syntactic sugar to improve readability. |
|
static org.hamcrest.Matcher<SIPAgent> |
onHold()
Factory method to create a matcher to check whether agent is on hold, either via "black-hole" SDP, or SDP in which all media descriptions have port 0. |
|
static org.hamcrest.Matcher<SIPAgent> |
recvdErrorResponse(BaseState state)
Factory method to create a matcher to check whether agent received an error response (response code between 400 and 699) in the specified state. |
|
static org.hamcrest.Matcher<SIPAgent> |
recvdErrorResponse(CommandId cmdId)
Factory method to create a matcher to check whether agent received a error response (response code between 400 and 699) for the specified earlier request. |
|
static org.hamcrest.Matcher<SIPAgent> |
recvdFinalResponse(BaseState state)
Factory method to create a matcher to check whether agent received a final response (response code between 200 and 699) in the specified state. |
|
static org.hamcrest.Matcher<SIPAgent> |
recvdFinalResponse(CommandId cmdId)
Factory method to create a matcher to check whether agent received a final response (response code between 200 and 699) for the specified earlier request. |
|
static org.hamcrest.Matcher<SIPAgent> |
recvdMessage(BaseState state,
MessageComparator comparator)
Factory method to create a matcher to check whether agent received a message with particular properties in the specified state. |
|
static org.hamcrest.Matcher<SIPAgent> |
recvdMessage(CommandId cmdId,
MessageComparator comparator)
Factory method to create a matcher to check whether agent received a response with particular properties to a request sent earlier. |
|
static org.hamcrest.Matcher<SIPAgent> |
recvdMessage(MessageComparator comparator)
Factory method to create a matcher to check whether agent ever received a message with specific properties. |
|
static org.hamcrest.Matcher<SIPAgent> |
recvdNewSDP()
Factory method to create a matcher to check whether an agent has received a different SDP since the last call to SIPAgent.markSDP() on the agent. |
|
static org.hamcrest.Matcher<SIPAgent> |
recvdNewSDP(boolean temporal)
Factory method to create a matcher to check whether an agent has received a SDP since the last call to SIPAgent.markSDP() on the agent. |
|
static org.hamcrest.Matcher<SIPAgent> |
recvdProvisionalResponse(BaseState state)
Factory method to create a matcher to check whether agent received a provisional response (response code between 100 and 199) in the specified state. |
|
static org.hamcrest.Matcher<SIPAgent> |
recvdProvisionalResponse(CommandId cmdId)
Factory method to create a matcher to check whether agent received a provisional response (response code between 100 and 199) for the specified earlier request. |
|
static org.hamcrest.Matcher<SIPAgent> |
recvdRedirectResponse(BaseState state)
Factory method to create a matcher to check whether agent received a redirect response (response code between 300 and 399) in the specified state. |
|
static org.hamcrest.Matcher<SIPAgent> |
recvdRedirectResponse(CommandId cmdId)
Factory method to create a matcher to check whether agent received a rediect response (response code between 300 and 399) for the specified earlier request. |
|
static org.hamcrest.Matcher<SIPAgent> |
recvdRequest(BaseState state,
java.lang.String method)
Factory method to create a matcher to check whether agent received a request with the specified method in the specified state |
|
static org.hamcrest.Matcher<SIPAgent> |
recvdRequest(java.lang.String method)
Factory method to create a matcher to check whether agent ever received a request with the specified method |
|
static org.hamcrest.Matcher<SIPAgent> |
recvdRequest(java.lang.String method,
java.util.regex.Pattern messagePattern,
java.util.regex.Pattern contentPattern)
Factory method to create a matcher to check whether agent received a request with the specified method and the message satisfies the specified regex pattern and the message body sastisfies the specified regex pattern. |
|
static org.hamcrest.Matcher<SIPAgent> |
recvdResponse(BaseState state,
int respCode)
Factory method to create a matcher to check whether agent received a response with the specified response code in the specified state. |
|
static org.hamcrest.Matcher<SIPAgent> |
recvdResponse(BaseState state,
int respCode1,
int respCode2)
Factory method to create a matcher to check whether agent received a response in the specified state and the response code is in the specified range. |
|
static org.hamcrest.Matcher<SIPAgent> |
recvdResponse(CommandId cmdId,
int respCode)
Factory method to create a matcher to check whether agent received a response for a specified earlier request and with specified response code. |
|
static org.hamcrest.Matcher<SIPAgent> |
recvdResponse(CommandId cmdId,
int respCode1,
int respCode2)
Factory method to create a matcher to check whether agent received a response for a specified earlier request and with response code in the specified range. |
|
static org.hamcrest.Matcher<SIPAgent> |
recvdResponse(CommandId cmdId,
int respCode,
java.util.regex.Pattern messagePattern,
java.util.regex.Pattern contentPattern)
|
|
static org.hamcrest.Matcher<SIPAgent> |
recvdResponse(int respCode)
Factory method to create a matcher to check whether agent ever received a response with the specified response code. |
|
static org.hamcrest.Matcher<SIPAgent> |
recvdResponse(int respCode,
java.util.regex.Pattern messagePattern,
java.util.regex.Pattern contentPattern)
Factory method to create a matcher to check whether agent received a response with the specified response code and the response satisfies the specified regex pattern and the response body sastisfies the specified regex pattern. |
|
static org.hamcrest.Matcher<SIPAgent> |
recvdSuccessResponse(BaseState state)
Factory method to create a matcher to check whether agent received a success response (response code between 200 and 299) in the specified state. |
|
static org.hamcrest.Matcher<SIPAgent> |
recvdSuccessResponse(CommandId cmdId)
Factory method to create a matcher to check whether agent received a success response (response code between 200 and 299) for the specified earlier request. |
|
static org.hamcrest.Matcher<SIPAgent> |
sentMessage(BaseState state,
MessageComparator comparator)
Factory method to create a matcher to check whether agent sent a message with specific properties in the specified state. |
|
static org.hamcrest.Matcher<SIPAgent> |
sentMessage(MessageComparator comparator)
Factory method to create a matcher to check whether agent ever sent a message with specific properties. |
|
static org.hamcrest.Matcher<SIPAgent> |
sentRequest(BaseState state,
java.lang.String method)
Factory method to create a matcher to check whether agent sent a request with the specified method in the specified state. |
|
static org.hamcrest.Matcher<SIPAgent> |
sentRequest(java.lang.String method)
Factory method to create a matcher to check whether agent ever sent a request with the specified method. |
|
static org.hamcrest.Matcher<SIPAgent> |
sentResponse(BaseState state,
int respCode)
Factory method to create a matcher to check whether agent sent a response with the specified response code in the specified state. |
|
static org.hamcrest.Matcher<SIPAgent> |
sentResponse(int respCode)
Factory method to create a matcher to check whether agent sent a response with the specified response code. |
|
static org.hamcrest.Matcher<SIPAgent> |
zeroPortSDP()
Factory method to create a matcher to check whether agent has current SDP in which all media descriptions have port 0. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static <T> org.hamcrest.Matcher<T> has(org.hamcrest.Matcher<T> matcher)
public static <T> org.hamcrest.Matcher<T> no(org.hamcrest.Matcher<T> matcher)
public static org.hamcrest.Matcher<SIPAgent> recvdNewSDP()
SIPAgent.markSDP()
on the agent. This is
the same as recvdNewSDP(false).
agent.markSDP();
....
//i am expecting a re-INVITE here for agent with
//a different SDP from the marked SDP.
....
assertThat(agent, has (recvdNewSDP()));
public static org.hamcrest.Matcher<SIPAgent> recvdNewSDP(boolean temporal)
SIPAgent.markSDP()
on the agent. If the
marked SDP (SDP saved by markSDP()) is different from the
latest SDP received, then this method returns true,
irrespective of the value of the argument passed. If the SDPs
are the same, a true
argument causes a temporal
comparison between the SDPs i.e., the time stamp of the
received SDPs are compared and if different, a
true
is returned.
agent.markSDP();
....
//i am expecting a re-INVITE here for agent with
//the same or different SDP as the marked SDP
....
assertThat(agent, has (recvdNewSDP(true)));
temporal
- whether SDPs should be compared temporally if
they are same.public static org.hamcrest.Matcher<SIPAgent> idle()
assertThat(agent, is (idle()) );
public static org.hamcrest.Matcher<SIPAgent> invited()
agent1.call(agent2);
processSIP(3000);
assertThat(agent2, is (invited()) );
public static org.hamcrest.Matcher<SIPAgent> connected()
agent1.call(agent2);
processSIP(3000);
assertThat(agent2, is (invited()) );
agent2.answer();
processSIP(2000);
assertThat(agent1, is (connected()) );
public static org.hamcrest.Matcher<SIPAgent> disconnected()
//agent1 and agent2 are in a call
agent2.end();
processSIP(2000);
assertThat(agent1, is (disconnected()) );
assertThat(agent2, is (disconnected()) );
public static org.hamcrest.Matcher<SIPAgent> connectedTo(SIPAgent peerAgent)
agent1.call(agent2);
processSIP(3000);
assertThat(agent2, is (invited()) );
agent2.answer();
processSIP(2000);
assertThat(agent1, is (connectedTo(agent2)) );
public static org.hamcrest.Matcher<SIPAgent> incomingMedia()
public static org.hamcrest.Matcher<SIPAgent> inState(BaseState expectedState)
agent1.call(agent2);
processSIP(3000);
assertThat(agent2, is (inState(CATState.Invited)));
public static org.hamcrest.Matcher<SIPAgent> recvdMessage(BaseState state, MessageComparator comparator)
MessageComparator
interface. This implementation must check
whether the message satisfies a particular property.
MessageComparator msgComparator =
new MessageComparator() {
public boolean compare(final javax.sip.message.Message msg) {
//user can check any property on the message using JAIN-SIP API.
}
}
agent1.call(agent2);
processSIP(3000);
assertThat(agent2, recvdMessage(CATState.Idle, msgComparator);
- Parameters:
state
- State of agentcomparator
- A message comparator that implements the
MessageComparator
interface.
public static org.hamcrest.Matcher<SIPAgent> recvdMessage(CommandId cmdId, MessageComparator comparator)
MessageComparator msgComparator = new MessageComparator() { public boolean compare(final javax.sip.message.Message msg) { //user can check any property on the message using JAIN-SIP API. } } CommandId callCmd = agent1.call(agent2); processSIP(3000); assertThat(agent2, recvdMessage(callCmd, msgComparator);
cmdId
- identifier for the earlier requestcomparator
- A message comparator that implements the
MessageComparator
interface.public static org.hamcrest.Matcher<SIPAgent> sentMessage(BaseState state, MessageComparator comparator)
state
- Agent machine statecomparator
- User specified message comparatorpublic static org.hamcrest.Matcher<SIPAgent> recvdMessage(MessageComparator comparator)
public static org.hamcrest.Matcher<SIPAgent> sentMessage(MessageComparator comparator)
public static org.hamcrest.Matcher<SIPAgent> recvdRequest(java.lang.String method)
public static org.hamcrest.Matcher<SIPAgent> recvdRequest(BaseState state, java.lang.String method)
public static org.hamcrest.Matcher<SIPAgent> recvdRequest(java.lang.String method, java.util.regex.Pattern messagePattern, java.util.regex.Pattern contentPattern)
method
- Request methodmessagePattern
- regex pattern to search in the requestcontentPattern
- regex pattern to search in the content of the request, if any.public static org.hamcrest.Matcher<SIPAgent> recvdResponse(int respCode)
public static org.hamcrest.Matcher<SIPAgent> recvdResponse(BaseState state, int respCode1, int respCode2)
state
- agent staterespCode1
- start of range for response coderespCode2
- end of range for response codepublic static org.hamcrest.Matcher<SIPAgent> recvdResponse(int respCode, java.util.regex.Pattern messagePattern, java.util.regex.Pattern contentPattern)
respCode
- response codemessagePattern
- regex pattern to search in the responsecontentPattern
- regex pattern to search in the content of the response, if any.public static org.hamcrest.Matcher<SIPAgent> recvdResponse(BaseState state, int respCode)
public static org.hamcrest.Matcher<SIPAgent> recvdProvisionalResponse(BaseState state)
public static org.hamcrest.Matcher<SIPAgent> recvdFinalResponse(BaseState state)
public static org.hamcrest.Matcher<SIPAgent> recvdSuccessResponse(BaseState state)
public static org.hamcrest.Matcher<SIPAgent> recvdRedirectResponse(BaseState state)
public static org.hamcrest.Matcher<SIPAgent> recvdErrorResponse(BaseState state)
public static org.hamcrest.Matcher<SIPAgent> recvdResponse(CommandId cmdId, int respCode1, int respCode2)
cmdId
- id of earlier requestrespCode1
- start of range for response coderespCode2
- end of range for response codepublic static org.hamcrest.Matcher<SIPAgent> recvdResponse(CommandId cmdId, int respCode)
cmdId
- id of earlier requestrespCode
- response codepublic static org.hamcrest.Matcher<SIPAgent> recvdResponse(CommandId cmdId, int respCode, java.util.regex.Pattern messagePattern, java.util.regex.Pattern contentPattern)
public static org.hamcrest.Matcher<SIPAgent> recvdProvisionalResponse(CommandId cmdId)
public static org.hamcrest.Matcher<SIPAgent> recvdFinalResponse(CommandId cmdId)
public static org.hamcrest.Matcher<SIPAgent> recvdSuccessResponse(CommandId cmdId)
public static org.hamcrest.Matcher<SIPAgent> recvdRedirectResponse(CommandId cmdId)
public static org.hamcrest.Matcher<SIPAgent> recvdErrorResponse(CommandId cmdId)
public static org.hamcrest.Matcher<SIPAgent> sentRequest(java.lang.String method)
public static org.hamcrest.Matcher<SIPAgent> sentRequest(BaseState state, java.lang.String method)
public static org.hamcrest.Matcher<SIPAgent> sentResponse(int respCode)
public static org.hamcrest.Matcher<SIPAgent> sentResponse(BaseState state, int respCode)
public static org.hamcrest.Matcher<SIPAgent> blackHoleSDP()
public static org.hamcrest.Matcher<SIPAgent> zeroPortSDP()
public static org.hamcrest.Matcher<SIPAgent> onHold()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |