public void testEncode() throws StunException {
  byte[] expectedReturn=msgFixture.errCodeTestValue;
  errorCodeAttribute.setErrorClass(MsgFixture.ERROR_CLASS);
  errorCodeAttribute.setErrorNumber(MsgFixture.ERROR_NUMBER);
  errorCodeAttribute.setReasonPhrase(MsgFixture.REASON_PHRASE);
  byte[] actualReturn=errorCodeAttribute.encode();
  assertTrue("encode() did not return the expected binary array.",Arrays.equals(expectedReturn,actualReturn));
}

public void testEncode ( ) throws StunException { byte [ ] expectedReturn = msgFixture . errCodeTestValue ; errorCodeAttribute . setErrorClass ( MsgFixture . ERROR_CLASS ) ; errorCodeAttribute . setErrorNumber ( MsgFixture . ERROR_NUMBER ) ; errorCodeAttribute . setReasonPhrase ( MsgFixture . REASON_PHRASE ) ; byte [ ] actualReturn = errorCodeAttribute . encode ( ) ; assertTrue ( "encode() did not return the expected binary array." , Arrays . equals ( expectedReturn , actualReturn ) ) ; }
construct and encode a sample object and assert equality with a sample binary array .
