package com.github.arteam.simplejsonrpc.client.generator;

import com.google.common.collect.Sets;
import org.junit.Assert;
import org.junit.Test;

import java.util.Set;

import static org.junit.Assert.*;

public class SecureRandomIntIdGeneratorTest {

    @Test
    public void testDefaultLimit() {
        SecureRandomIntIdGenerator generator = new SecureRandomIntIdGenerator();
        Integer value = generator.generate();
        Assert.assertTrue(value >= 0);
        Assert.assertTrue(value < 65536);
    }

    @Test
    public void testGenerate() throws Exception {
        int limit = 1000000;
        SecureRandomIntIdGenerator generator = new SecureRandomIntIdGenerator(limit);
        int amount = 100;
        Set<Integer> ids = Sets.newHashSet();
        for (int i = 0; i < amount; i++) {
            Integer value = generator.generate();
            System.out.println(value);
            Assert.assertTrue(value >= 0);
            Assert.assertTrue(value < limit);
            ids.add(value);
        }

        Assert.assertEquals(ids.size(), amount);
    }

    @Test(expected = IllegalArgumentException.class)
    public void testPositiveLimit() {
        new SecureRandomIntIdGenerator(-1);
    }
}
@@ -712,54 +712,8 @@
 00;%0A
-        Set%3CInteger%3E ids = Sets.newHashSet();%0A
     
@@ -747,24 +747,24 @@
 unt; i++) %7B%0A
+
             
@@ -805,47 +805,8 @@
 ();%0A
-            System.out.println(value);%0A
     
@@ -902,87 +902,9 @@
     
-    ids.add(value);%0A        %7D%0A%0A        Assert.assertEquals(ids.size(), amount);
+%7D
 %0A   

Fix SecureRandomIntIdGeneratorTest#generate