Skip to content

Instantly share code, notes, and snippets.

@hyzhak
Created June 8, 2012 11:56
Show Gist options
  • Save hyzhak/2895244 to your computer and use it in GitHub Desktop.
Save hyzhak/2895244 to your computer and use it in GitHub Desktop.
Test hamcrest.as to compare two ByteArrays
import org.hamcrest.assertThat;
import org.hamcrest.object.equalTo;
/**
* Test failed with message:
*
* Error: Expected: <test.string>
* but: was <test.string>
*
*/
[Test]
public function testByteArrayComparison() : void
{
var test : String = "test.string";
var ba1 : ByteArray = new ByteArray();
ba1.writeUTFBytes(test);
var ba2 : ByteArray = new ByteArray();
ba2.writeUTFBytes(test);
assertThat(ba1, equalTo(ba2));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment