testing cleanup

This commit is contained in:
Eugen Paraschiv
2018-03-04 18:05:37 +02:00
parent 8d633d6402
commit 698e78150c
7 changed files with 139 additions and 145 deletions

View File

@@ -0,0 +1,21 @@
package com.baeldung.infinispan.service;
import com.baeldung.infinispan.ConfigurationTest;
import org.junit.Test;
import static org.assertj.core.api.Java6Assertions.assertThat;
public class TransactionalServiceIntegrationTest extends ConfigurationTest {
@Test
public void whenLockingAnEntry_thenItShouldBeInaccessible() throws InterruptedException {
Runnable backGroundJob = () -> transactionalService.startBackgroundBatch();
Thread backgroundThread = new Thread(backGroundJob);
transactionalService.getQuickHowManyVisits();
backgroundThread.start();
Thread.sleep(100); // lets wait our thread warm up
assertThat(timeThis(() -> transactionalService.getQuickHowManyVisits())).isGreaterThan(500).isLessThan(1000);
}
}