/*
 * Copyright (c) 2015 Cinchapi Inc.
 *
 * 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 com.cinchapi.common.base;


import java.util.UUID;

import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;


public class ArrayBuilderTest {

    private ArrayBuilder<Object> arrayBuilder;


    @Before
    public void testArrayBuilder() {
        arrayBuilder = ArrayBuilder.builder();

        Assert.assertNotNull( arrayBuilder );
    }


    @Test
    public void testAddToArray() {
        int size = 100;

        for ( int i = 0; i < size; i++ ) {
            arrayBuilder.add( UUID.randomUUID().toString() );
        }

        int length = arrayBuilder.build().length;

        Assert.assertEquals( length, size );
    }


    @Test( expected = NegativeArraySizeException.class )
    public void testNegativeArraySizeException() {

        int size = 1000;

        for ( int i = 0; i < size; i++ ) {
            arrayBuilder.add( UUID.randomUUID().toString() );
        }

        arrayBuilder.build();
    }
}

@@ -34,16 +34,17 @@
  Inc.%0A *
+ 
 %0A * Lice
@@ -216,16 +216,17 @@
 se at%0A *
+ 
 %0A * http
@@ -266,16 +266,17 @@
 E-2.0%0A *
+ 
 %0A * Unle
@@ -629,17 +629,16 @@
 .base;%0A%0A
-%0A
 import j
@@ -727,17 +727,16 @@
 .Test;%0A%0A
-%0A
 public c
@@ -808,17 +808,16 @@
 ilder;%0A%0A
-%0A
     @Bef
@@ -934,17 +934,16 @@
 NotNull(
- 
 arrayBui
@@ -946,17 +946,16 @@
 yBuilder
- 
 );%0A    %7D
@@ -948,33 +948,32 @@
 uilder);%0A    %7D%0A%0A
-%0A
     @Test%0A    pu
@@ -1031,33 +1031,32 @@
 ;%0A%0A        for (
- 
 int i = 0; i %3C s
@@ -1055,33 +1055,32 @@
 0; i %3C size; i++
- 
 ) %7B%0A            
@@ -1088,33 +1088,32 @@
 rrayBuilder.add(
- 
 UUID.randomUUID(
@@ -1116,33 +1116,32 @@
 UID().toString()
- 
 );%0A        %7D%0A%0A  
@@ -1129,33 +1129,32 @@
 g());%0A        %7D%0A
-%0A
         int leng
@@ -1187,17 +1187,16 @@
 length;%0A
-%0A
         
@@ -1215,17 +1215,16 @@
 tEquals(
- 
 length, 
@@ -1227,17 +1227,16 @@
 th, size
- 
 );%0A    %7D
@@ -1237,17 +1237,16 @@
 %0A    %7D%0A%0A
-%0A
     @Tes
@@ -1247,17 +1247,16 @@
   @Test(
- 
 expected
@@ -1290,17 +1290,16 @@
 on.class
- 
 )%0A    pu
@@ -1343,17 +1343,16 @@
 ion() %7B%0A
-%0A
         
@@ -1364,25 +1364,24 @@
 ize = 1000;%0A
-%0A
         for 
@@ -1381,17 +1381,16 @@
    for (
- 
 int i = 
@@ -1405,17 +1405,16 @@
 ize; i++
- 
 ) %7B%0A    
@@ -1438,17 +1438,16 @@
 der.add(
- 
 UUID.ran
@@ -1466,17 +1466,16 @@
 String()
- 
 );%0A     
@@ -1475,25 +1475,24 @@
 ;%0A        %7D%0A
-%0A
         arra

fix formatting of unit test