@@ -0,0 +1,1112 @@
+package ru.nsu.ccfit.bogush.chat.server;%0A%0Aimport org.junit.Test;%0A%0Aimport static org.junit.Assert.*;%0A%0Apublic class ConcurrentRollingArrayTest %7B%0A%09@Test(expected = IllegalArgumentException.class)%0A%09public void createEmpty() %7B%0A%09%09new ConcurrentRollingArray%3C%3E(0);%0A%09%7D%0A%0A%09@Test(expected = IllegalArgumentException.class)%0A%09public void createNegativeCapacity() %7B%0A%09%09new ConcurrentRollingArray%3C%3E(-1);%0A%09%7D%0A%0A%09@Test%0A%09public void createNonEmpty() %7B%0A%09%09new ConcurrentRollingArray%3C%3E(100);%0A%09%7D%0A%0A%09@Test%0A%09public void createAndAddElements() %7B%0A%09%09ConcurrentRollingArray%3CObject%3E array = new ConcurrentRollingArray%3C%3E(2);%0A%09%09array.add(new Object());%0A%09%09array.add(new Object());%0A%09%09array.add(new Object());%0A%09%7D%0A%0A%09@Test%0A%09public void correctElementsInRightPlace() %7B%0A%09%09int capacity = 3;%0A%09%09ConcurrentRollingArray%3CInteger%3E array = new ConcurrentRollingArray%3C%3E(capacity);%0A%09%09for (int i = 0; i %3C capacity * 3; i++) %7B%0A%09%09%09array.add(i);%0A%09%09%09int got = array.get(i %25 capacity);%0A%09%09%09assertEquals(i, got);%0A%09%09%7D%0A%09%09Integer%5B%5D elements = array.toArray(new Integer%5Barray.size()%5D);%0A%09%09for (int i = 0; i %3C capacity; i++) %7B%0A%09%09%09assertEquals(elements%5Bi%5D, array.get(i));%0A%09%09%7D%0A%09%7D%0A%7D

Add unit tests for rolling array