[Java] Fix the issue when waiting an empty list or a null pointer (#3632)

This commit is contained in:
Wang Qing
2018-12-26 11:29:29 +08:00
committed by Hao Chen
parent f4011754d6
commit a971b73bbe
2 changed files with 20 additions and 0 deletions
@@ -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);
}
}
}