}
@Test
public void valueToStringBinary() throws Exception {
final byte[] binary = new byte[] { (byte) 0xAA, (byte) 0xBB, (byte) 0xCC, (byte) 0xDD, (byte) 0xEE, (byte) 0xFF };
final EdmSimpleType instance = EdmSimpleTypeKind.Binary.getEdmSimpleTypeInstance();
assertEquals("qrvM3e7/", instance.valueToString(binary, EdmLiteralKind.DEFAULT, null));
assertEquals("qrvM3e7/", instance.valueToString(binary, EdmLiteralKind.JSON, null));
assertEquals("binary'AABBCCDDEEFF'", instance.valueToString(binary, EdmLiteralKind.URI, null));
assertEquals("qrvM3e7/", instance.valueToString(binary, EdmLiteralKind.DEFAULT, getMaxLengthFacets(6)));
assertEquals("qrvM3e7/", instance.valueToString(binary, EdmLiteralKind.JSON, getMaxLengthFacets(6)));
assertEquals("binary'AABBCCDDEEFF'", instance.valueToString(binary, EdmLiteralKind.URI, getMaxLengthFacets(6)));
assertEquals("qrvM3e7/", instance.valueToString(binary, EdmLiteralKind.DEFAULT,
getMaxLengthFacets(Integer.MAX_VALUE)));
assertEquals("binary'AABBCCDDEEFF'", instance.valueToString(binary, EdmLiteralKind.URI,
getMaxLengthFacets(Integer.MAX_VALUE)));
assertEquals("qrvM3e7/", instance.valueToString(binary, EdmLiteralKind.DEFAULT, getMaxLengthFacets(null)));
assertEquals("qg==", instance.valueToString(new Byte[] { new Byte((byte) 170) }, EdmLiteralKind.DEFAULT, null));
expectErrorInValueToString(instance, binary, EdmLiteralKind.DEFAULT, getMaxLengthFacets(3),
EdmSimpleTypeException.VALUE_FACETS_NOT_MATCHED);
expectErrorInValueToString(instance, binary, EdmLiteralKind.JSON, getMaxLengthFacets(3),
EdmSimpleTypeException.VALUE_FACETS_NOT_MATCHED);