blob: 09ea326c39f732a278cd3027fb6f096d23fbd260 [file] [log] [blame]
Alexander Afanasyeva8bc0d82016-01-25 17:25:30 -08001/*
2 * jndn-management
3 * Copyright (c) 2016, Regents of the University of California
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms and conditions of the GNU Lesser General Public License,
7 * version 3, as published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope it will be useful, but WITHOUT ANY
10 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11 * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for
12 * more details.
13 */
14package com.intel.jndn.management;
15
16import java.nio.ByteBuffer;
17
18/**
19 * Helper methods for unit tests
20 */
21public class TestHelper {
22 /**
23 * Prevent instances of TestHelper
24 */
25 private TestHelper() {
26 }
27
28 /**
29 * Construct ByteBuffer from int[]
30 */
31 public static ByteBuffer
32 bufferFromIntArray(int[] array)
33 {
34 ByteBuffer result = ByteBuffer.allocate(array.length);
35 for (int value : array) {
36 result.put((byte) (value & 0xFF));
37 }
38
39 result.flip();
40 return result;
41 }
42}