public void testAppendParametersDigest() { Name name = new Name("/local/ndn/prefix"); Interest interest = new Interest(name); Assert.AssertTrue(!interest.hasParameters()); // No parameters yet, so it should do nothing. interest.appendParametersDigestToName(); Assert.AssertEquals("/local/ndn/prefix", interest.getName().toUri()); Blob parameters = new Blob(toBuffer(new int[] { 0x23, 0x01, 0xC0 }), false); interest.setParameters(parameters); Assert.AssertTrue(interest.hasParameters()); interest.appendParametersDigestToName(); Assert.AssertEquals(name.size() + 1, interest.getName().size()); Assert.AssertTrue(interest.getName().getPrefix(-1).equals(name)); int SHA256_LENGTH = 32; Assert.AssertEquals(SHA256_LENGTH, interest.getName().get(-1).getValue() .size()); Assert.AssertEquals( interest.getName().toUri(), "/local/ndn/prefix/" + "params-sha256=a16cc669b4c9ef6801e1569488513f9523ffb28a39e53aa6e11add8d00a413fc"); }