del: TestCore
В нем нет необходимости
This commit is contained in:
@@ -1,51 +0,0 @@
|
|||||||
package test.core;
|
|
||||||
|
|
||||||
import kinosearch.core.Kino;
|
|
||||||
import kinosearch.core.Tools;
|
|
||||||
import kinosearch.core.warez.KinoWarez;
|
|
||||||
import org.junit.Test;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
import static org.junit.Assert.*;
|
|
||||||
|
|
||||||
public class TestCore {
|
|
||||||
@Test
|
|
||||||
public void test() {
|
|
||||||
Set<KinoWarez> set = Tools.getKinoWarezSet();
|
|
||||||
assertNotNull(set);
|
|
||||||
assertFalse(set.isEmpty());
|
|
||||||
|
|
||||||
List<Kino> list = Collections.synchronizedList(new ArrayList<>());
|
|
||||||
|
|
||||||
String kinoName = "бэтмен";
|
|
||||||
|
|
||||||
ThreadGroup threadGroup = new ThreadGroup("Search Threads Group");
|
|
||||||
|
|
||||||
int i = 0;
|
|
||||||
for(KinoWarez kinoWarez : set) {
|
|
||||||
new Thread(threadGroup, () -> {
|
|
||||||
System.err.println(Thread.currentThread().getName() + " :: start"); //DEBUG
|
|
||||||
kinoWarez.search(kinoName, list);
|
|
||||||
System.err.println(Thread.currentThread().getName() + " :: stop"); //DEBUG
|
|
||||||
}, "THR-" + (++i)).start();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
i = 0;
|
|
||||||
while (threadGroup.activeCount() > 0) {
|
|
||||||
System.err.println("wait("+(++i)+")..."); //DEBUG
|
|
||||||
Tools.SafeSleep(1000);
|
|
||||||
}
|
|
||||||
|
|
||||||
assertFalse(list.isEmpty());
|
|
||||||
|
|
||||||
for (Kino kino : list) {
|
|
||||||
System.out.printf("\"%s\" (%s)\n", kino.getName(), kino.getUrl()); //DEBUG
|
|
||||||
assertTrue(kino.getName().toLowerCase().contains(kinoName.toLowerCase()));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user