package com.devskiller.friendly_id;

import java.util.ArrayList;
import java.util.IntSummaryStatistics;
import java.util.List;
import java.util.UUID;
import java.util.stream.Collectors;

import org.junit.Test;

import static org.assertj.core.api.Assertions.assertThat;

public class AnalyzeGeneratedIdsTest {

	private List<String> ids = new ArrayList<>();

	@Test
	public void analyzeGeneratedValueStatistics() {
		for (int i = 0; i < 1_000_000; i++) {
			System.out.print(".");
			this.ids.add(Base62.encode(UuidConverter.convertToBigInteger(UUID.randomUUID())));
		}
		IntSummaryStatistics elegantStats = ids.stream()
				.map(String::length).mapToInt(Integer::intValue).summaryStatistics();

		System.out.println("\nResults:");
		System.out.println("Min: " + elegantStats.getMin());
		System.out.println("Max: " + elegantStats.getMax());
		System.out.println("Avg: " + elegantStats.getAverage());
		System.out.println("Count: " + elegantStats.getCount());
		System.out.println("Sample: " + ids.stream().limit(100).collect(Collectors.joining("\n")));

		assertThat(elegantStats.getMax()).isEqualTo(22);
		assertThat(elegantStats.getMin()).isEqualTo(22);
		assertThat(elegantStats.getAverage()).isEqualTo(22);
	}


}
@@ -430,16 +430,17 @@
 0; i %3C 1
+0
 _000_000
@@ -452,34 +452,8 @@
 ) %7B%0A
-%09%09%09System.out.print(%22.%22);%0A
 %09%09%09t
@@ -561,24 +561,17 @@
 tistics 
-elegantS
+s
 tats = i
@@ -585,13 +585,8 @@
 am()
-%0A%09%09%09%09
 .map
@@ -715,32 +715,25 @@
 n(%22Min: %22 + 
-elegantS
+s
 tats.getMin(
@@ -763,32 +763,25 @@
 n(%22Max: %22 + 
-elegantS
+s
 tats.getMax(
@@ -811,32 +811,25 @@
 n(%22Avg: %22 + 
-elegantS
+s
 tats.getAver
@@ -869,24 +869,17 @@
 nt: %22 + 
-elegantS
+s
 tats.get
@@ -918,16 +918,18 @@
 Sample: 
+%5Cn
 %22 + ids.
@@ -994,32 +994,25 @@
 %09assertThat(
-elegantS
+s
 tats.getMax(
@@ -1038,32 +1038,25 @@
 %09assertThat(
-elegantS
+s
 tats.getMin(
@@ -1056,32 +1056,45 @@
 getMin()).is
+GreaterThanOr
 EqualTo(
 22);%0A%09%09asser
@@ -1073,34 +1073,34 @@
 erThanOrEqualTo(
-22
+18
 );%0A%09%09assertThat(
@@ -1103,16 +1103,9 @@
 hat(
-elegantS
+s
 tats
@@ -1117,24 +1117,34 @@
 verage()).is
+LessThanOr
 EqualTo(22);
@@ -1148,10 +1148,9 @@
 2);%0A%09%7D%0A%0A
-%0A
 %7D

fix analyzer test