2 * Copyright (c) 2015 Cisco Systems, Inc. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
9 package org.opendaylight.controller.cluster.datastore.node.utils.stream;
11 import static org.junit.Assert.assertEquals;
13 import org.junit.Test;
15 public class ValueTypesTest {
17 public void testStringType() {
18 assertEquals(ValueTypes.STRING_TYPE, ValueTypes.getSerializableType("foobar"));
19 final String largeString = largeString(ValueTypes.STRING_BYTES_LENGTH_THRESHOLD);
20 assertEquals(ValueTypes.STRING_BYTES_TYPE, ValueTypes.getSerializableType(largeString));
23 private static String largeString(int minSize) {
24 final int pow = (int) (Math.log(minSize * 2) / Math.log(2));
26 for (int i = 0; i < pow; i++) {
27 StringBuilder buf = new StringBuilder();
28 buf.append(str).append(str);