From 1212f50d516a31adb74dd24a07b86ed07ca304c6 Mon Sep 17 00:00:00 2001 From: Adrian Cole Date: Tue, 30 Nov 2010 14:07:59 +0000 Subject: [PATCH] missing test --- .../io/payloads/StringPayloadTest.java | 40 +++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 core/src/test/java/org/jclouds/io/payloads/StringPayloadTest.java diff --git a/core/src/test/java/org/jclouds/io/payloads/StringPayloadTest.java b/core/src/test/java/org/jclouds/io/payloads/StringPayloadTest.java new file mode 100644 index 0000000000..6a0fbfa7c8 --- /dev/null +++ b/core/src/test/java/org/jclouds/io/payloads/StringPayloadTest.java @@ -0,0 +1,40 @@ +/** + * + * Copyright (C) 2010 Cloud Conscious, LLC. + * + * ==================================================================== + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ==================================================================== + */ + +package org.jclouds.io.payloads; + +import static org.testng.Assert.assertEquals; + +import org.jclouds.io.Payload; +import org.testng.annotations.Test; + +import com.google.common.base.Charsets; + +/** + * + * @author Adrian Cole + */ +@Test +public class StringPayloadTest { + public void testLengthIsCorrectPerUTF8() { + Payload stringPayload = new StringPayload("unic₪de"); + assertEquals(stringPayload.getContentMetadata().getContentLength(), new Long( + "unic₪de".getBytes(Charsets.UTF_8).length)); + } +}