BAEL-19699: Fix core-java-concurrency-basic unit tests
This commit is contained in:
parent
e827db3db2
commit
d5359a58e1
|
@ -19,7 +19,10 @@ public class CounterUnitTest {
|
||||||
Future<Integer> future1 = (Future<Integer>) executorService.submit(new CounterCallable(counter));
|
Future<Integer> future1 = (Future<Integer>) executorService.submit(new CounterCallable(counter));
|
||||||
Future<Integer> future2 = (Future<Integer>) executorService.submit(new CounterCallable(counter));
|
Future<Integer> future2 = (Future<Integer>) executorService.submit(new CounterCallable(counter));
|
||||||
|
|
||||||
assertThat(future1.get()).isEqualTo(1);
|
// Just to make sure both are completed
|
||||||
assertThat(future2.get()).isEqualTo(2);
|
future1.get();
|
||||||
|
future2.get();
|
||||||
|
|
||||||
|
assertThat(counter.getCounter()).isEqualTo(2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,7 +19,10 @@ public class ExtrinsicLockCounterUnitTest {
|
||||||
Future<Integer> future1 = (Future<Integer>) executorService.submit(new ExtrinsicLockCounterCallable(counter));
|
Future<Integer> future1 = (Future<Integer>) executorService.submit(new ExtrinsicLockCounterCallable(counter));
|
||||||
Future<Integer> future2 = (Future<Integer>) executorService.submit(new ExtrinsicLockCounterCallable(counter));
|
Future<Integer> future2 = (Future<Integer>) executorService.submit(new ExtrinsicLockCounterCallable(counter));
|
||||||
|
|
||||||
assertThat(future1.get()).isEqualTo(1);
|
// Just to make sure both are completed
|
||||||
assertThat(future2.get()).isEqualTo(2);
|
future1.get();
|
||||||
|
future2.get();
|
||||||
|
|
||||||
|
assertThat(counter.getCounter()).isEqualTo(2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,7 +19,10 @@ public class ReentrantLockCounterUnitTest {
|
||||||
Future<Integer> future1 = (Future<Integer>) executorService.submit(new ReentrantLockCounterCallable(counter));
|
Future<Integer> future1 = (Future<Integer>) executorService.submit(new ReentrantLockCounterCallable(counter));
|
||||||
Future<Integer> future2 = (Future<Integer>) executorService.submit(new ReentrantLockCounterCallable(counter));
|
Future<Integer> future2 = (Future<Integer>) executorService.submit(new ReentrantLockCounterCallable(counter));
|
||||||
|
|
||||||
assertThat(future1.get()).isEqualTo(1);
|
// Just to make sure both are completed
|
||||||
assertThat(future2.get()).isEqualTo(2);
|
future1.get();
|
||||||
|
future2.get();
|
||||||
|
|
||||||
|
assertThat(counter.getCounter()).isEqualTo(2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,8 +19,11 @@ public class ReentrantReadWriteLockCounterUnitTest {
|
||||||
Future<Integer> future1 = (Future<Integer>) executorService.submit(new ReentranReadWriteLockCounterCallable(counter));
|
Future<Integer> future1 = (Future<Integer>) executorService.submit(new ReentranReadWriteLockCounterCallable(counter));
|
||||||
Future<Integer> future2 = (Future<Integer>) executorService.submit(new ReentranReadWriteLockCounterCallable(counter));
|
Future<Integer> future2 = (Future<Integer>) executorService.submit(new ReentranReadWriteLockCounterCallable(counter));
|
||||||
|
|
||||||
assertThat(future2.get()).isEqualTo(2);
|
// Just to make sure both are completed
|
||||||
assertThat(future1.get()).isEqualTo(1);
|
future1.get();
|
||||||
|
future2.get();
|
||||||
|
|
||||||
|
assertThat(counter.getCounter()).isEqualTo(2);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue