You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by gg...@apache.org on 2016/05/07 00:07:07 UTC

svn commit: r1742676 - /commons/proper/io/trunk/src/test/java/org/apache/commons/io/ByteOrderFactoryTest.java

Author: ggregory
Date: Sat May  7 00:07:07 2016
New Revision: 1742676

URL: http://svn.apache.org/viewvc?rev=1742676&view=rev
Log:
[IO-507] Add a ByteOrderFactory class.

Added:
    commons/proper/io/trunk/src/test/java/org/apache/commons/io/ByteOrderFactoryTest.java

Added: commons/proper/io/trunk/src/test/java/org/apache/commons/io/ByteOrderFactoryTest.java
URL: http://svn.apache.org/viewvc/commons/proper/io/trunk/src/test/java/org/apache/commons/io/ByteOrderFactoryTest.java?rev=1742676&view=auto
==============================================================================
--- commons/proper/io/trunk/src/test/java/org/apache/commons/io/ByteOrderFactoryTest.java (added)
+++ commons/proper/io/trunk/src/test/java/org/apache/commons/io/ByteOrderFactoryTest.java Sat May  7 00:07:07 2016
@@ -0,0 +1,43 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.apache.commons.io;
+
+import java.nio.ByteOrder;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+public class ByteOrderFactoryTest {
+
+    private ByteOrder parseByteOrder(final String value) {
+        return ByteOrderFactory.parseByteOrder(value);
+    }
+
+    @Test
+    public void testParseBig() {
+        Assert.assertEquals(ByteOrder.BIG_ENDIAN, parseByteOrder("big"));
+        Assert.assertEquals(ByteOrder.BIG_ENDIAN, parseByteOrder("Big"));
+        Assert.assertEquals(ByteOrder.BIG_ENDIAN, parseByteOrder("BIG"));
+    }
+
+    @Test
+    public void testParseLittle() {
+        Assert.assertEquals(ByteOrder.LITTLE_ENDIAN, parseByteOrder("little"));
+        Assert.assertEquals(ByteOrder.LITTLE_ENDIAN, parseByteOrder("Little"));
+        Assert.assertEquals(ByteOrder.LITTLE_ENDIAN, parseByteOrder("LITTLE"));
+    }
+}