mirror of
https://github.com/wassname/ray.git
synced 2026-07-13 17:45:08 +08:00
[Java] Fix the issue when waiting an empty list or a null pointer (#3632)
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package org.ray.api.test;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
@@ -56,4 +57,18 @@ public class WaitTest extends BaseTest {
|
||||
RayObject<Object> res = Ray.call(WaitTest::waitInWorker);
|
||||
res.get();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testWaitForEmpty() {
|
||||
WaitResult<String> result = Ray.wait(new ArrayList<>());
|
||||
Assert.assertTrue(result.getReady().isEmpty());
|
||||
Assert.assertTrue(result.getUnready().isEmpty());
|
||||
|
||||
try {
|
||||
Ray.wait(null);
|
||||
Assert.fail();
|
||||
} catch (NullPointerException e) {
|
||||
Assert.assertTrue(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user