mirror of
https://github.com/tiennm99/java-design-patterns.git
synced 2026-06-07 14:12:22 +00:00
Java 11 migrate remaining (g,h,i) (#1116)
* Moves game-loop to Java 11 * Moves guarded-suspension to Java 11 * Moves half-sync-half-async to Java 11 * Moves hexagonal to Java 11 * Moves intercepting-filter to Java 11 * Moves interpreter to Java 11 * Moves iterator to Java 11
This commit is contained in:
committed by
Ilkka Seppälä
parent
7d0a5c0edb
commit
f835d3d516
+5
-7
@@ -23,13 +23,11 @@
|
||||
|
||||
package com.iluwatar.guarded.suspension;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
/**
|
||||
* Test for Guarded Queue
|
||||
@@ -39,8 +37,8 @@ public class GuardedQueueTest {
|
||||
|
||||
@Test
|
||||
public void testGet() {
|
||||
GuardedQueue g = new GuardedQueue();
|
||||
ExecutorService executorService = Executors.newFixedThreadPool(2);
|
||||
var g = new GuardedQueue();
|
||||
var executorService = Executors.newFixedThreadPool(2);
|
||||
executorService.submit(() -> value = g.get());
|
||||
executorService.submit(() -> g.put(10));
|
||||
executorService.shutdown();
|
||||
@@ -54,7 +52,7 @@ public class GuardedQueueTest {
|
||||
|
||||
@Test
|
||||
public void testPut() {
|
||||
GuardedQueue g = new GuardedQueue();
|
||||
var g = new GuardedQueue();
|
||||
g.put(12);
|
||||
assertEquals(Integer.valueOf(12), g.get());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user