@@ -75,74 +75,74 @@ class SimplePromiseTest {
7575 class SimplePromiseCompletedPromiseTest {
7676 @Test
7777 void testCompletedPromiseWithValue () throws Exception {
78- Promise<Integer > p = SimplePromise . completedPromise(42 );
78+ Promise<Integer > p = SimplePromise . completedPromise(42 )
7979
80- assertTrue (p. isDone(), " promise should be done" );
81- assertFalse (p. isCancelled(), " should not be cancelled" );
82- assertFalse (p. isCompletedExceptionally(), " should not be completed exceptionally" );
80+ assertTrue (p. isDone(), " promise should be done" )
81+ assertFalse (p. isCancelled(), " should not be cancelled" )
82+ assertFalse (p. isCompletedExceptionally(), " should not be completed exceptionally" )
8383
8484 // blocking and non-blocking retrievals
85- assertEquals (42 , p. join());
86- assertEquals (42 , p. await());
87- assertEquals (42 , p. get());
88- assertEquals (42 , p. getNow(0 ));
89- assertEquals (42 , p. toCompletableFuture(). get());
90- assertEquals (42 , p. get(1 , TimeUnit . SECONDS ));
85+ assertEquals (42 , p. join())
86+ assertEquals (42 , p. await())
87+ assertEquals (42 , p. get())
88+ assertEquals (42 , p. getNow(0 ))
89+ assertEquals (42 , p. toCompletableFuture(). get())
90+ assertEquals (42 , p. get(1 , TimeUnit . SECONDS ))
9191
9292 // attempting to cancel or complete an already-completed promise returns false
93- assertFalse (p. cancel(true ));
94- assertFalse (p. complete(99 ));
93+ assertFalse (p. cancel(true ))
94+ assertFalse (p. complete(99 ))
9595 }
9696
9797 @Test
9898 void testCompletedPromiseWithNull () throws Exception {
99- Promise<Object > p = SimplePromise . completedPromise(null );
99+ Promise<Object > p = SimplePromise . completedPromise(null )
100100
101- assertTrue (p. isDone());
102- assertFalse (p. isCompletedExceptionally());
103- assertNull (p. join());
104- assertNull (p. await());
105- assertNull (p. getNow(" absent" ));
106- assertNull (p. toCompletableFuture(). get());
101+ assertTrue (p. isDone())
102+ assertFalse (p. isCompletedExceptionally())
103+ assertNull (p. join())
104+ assertNull (p. await())
105+ assertNull (p. getNow(" absent" ))
106+ assertNull (p. toCompletableFuture(). get())
107107 }
108108
109109 @Test
110110 void testThenApplyOnCompletedPromise () {
111- Promise<Integer > p = SimplePromise . completedPromise(5 );
111+ Promise<Integer > p = SimplePromise . completedPromise(5 )
112112
113- Promise<Integer > mapped = p. thenApply(x -> x * 11 );
113+ Promise<Integer > mapped = p. thenApply(x -> x * 11 )
114114
115115 // mapping should produce the expected result immediately
116- assertEquals (55 , mapped. join());
117- assertFalse (mapped. isCompletedExceptionally());
116+ assertEquals (55 , mapped. join())
117+ assertFalse (mapped. isCompletedExceptionally())
118118 }
119119
120120 @Test
121121 void testCompleteReturnsFalseAndObtrudeValueOverrides () {
122- Promise<Integer > p = SimplePromise . completedPromise(1 );
122+ Promise<Integer > p = SimplePromise . completedPromise(1 )
123123
124124 // cannot complete again
125- assertFalse (p. complete(2 ));
126- assertEquals (1 , p. join());
125+ assertFalse (p. complete(2 ))
126+ assertEquals (1 , p. join())
127127
128128 // obtrudeValue forcibly changes the stored value
129- p. obtrudeValue(2 );
130- assertEquals (2 , p. join());
129+ p. obtrudeValue(2 )
130+ assertEquals (2 , p. join())
131131 }
132132
133133 @Test
134134 void testObtrudeExceptionMakesPromiseExceptional () {
135- Promise<Integer > p = SimplePromise . completedPromise(3 );
135+ Promise<Integer > p = SimplePromise . completedPromise(3 )
136136
137- p. obtrudeException(new IllegalStateException (" boom" ));
137+ p. obtrudeException(new IllegalStateException (" boom" ))
138138
139- assertTrue (p. isCompletedExceptionally());
139+ assertTrue (p. isCompletedExceptionally())
140140
141141 // join throws CompletionException
142- assertThrows(CompletionException . class, p ::join);
142+ assertThrows(CompletionException . class, p ::join)
143143
144144 // await wraps thrown exception in AwaitException
145- assertThrows(AwaitException . class, p ::await);
145+ assertThrows(AwaitException . class, p ::await)
146146 }
147147 }
148148
0 commit comments