• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2007 The Guava Authors
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 package com.google.common.io;
18 
19 import junit.framework.TestCase;
20 
21 /**
22  * Base test case class for I/O tests.
23  *
24  * @author Chris Nokleberg
25  */
26 public abstract class IoTestCase extends TestCase {
27 
28   static final String I18N
29       = "\u00CE\u00F1\u0163\u00E9\u0072\u00F1\u00E5\u0163\u00EE\u00F6"
30       + "\u00F1\u00E5\u013C\u00EE\u017E\u00E5\u0163\u00EE\u00F6\u00F1";
31 
32   static final String ASCII
33       = " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ"
34       + "[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~";
35 
36   /** Returns a byte array of length size that has values 0 .. size - 1. */
newPreFilledByteArray(int size)37   protected static byte[] newPreFilledByteArray(int size) {
38     return newPreFilledByteArray(0, size);
39   }
40 
41   /**
42    * Returns a byte array of length size that has values
43    *    offset .. offset + size - 1.
44    */
newPreFilledByteArray(int offset, int size)45   protected static byte[] newPreFilledByteArray(int offset, int size) {
46     byte[] array = new byte[size];
47     for (int i = 0; i < size; i++) {
48       array[i] = (byte) (offset + i);
49     }
50     return array;
51   }
52 }
53