diff --git a/user/test/com/google/gwt/emultest/EmulJava11Suite.java b/user/test/com/google/gwt/emultest/EmulJava11Suite.java new file mode 100644 index 0000000000..18260e0714 --- /dev/null +++ b/user/test/com/google/gwt/emultest/EmulJava11Suite.java @@ -0,0 +1,34 @@ +/* + * Copyright 2023 Google Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package com.google.gwt.emultest; + +import com.google.gwt.emultest.java11.util.OptionalDoubleTest; +import com.google.gwt.emultest.java11.util.OptionalIntTest; +import com.google.gwt.emultest.java11.util.OptionalLongTest; +import com.google.gwt.emultest.java11.util.OptionalTest; +import org.junit.runner.RunWith; +import org.junit.runners.Suite; + +/** Test JRE emulations. */ +@RunWith(Suite.class) +@Suite.SuiteClasses({ + OptionalDoubleTest.class, + OptionalIntTest.class, + OptionalLongTest.class, + OptionalTest.class, +}) +public class EmulJava11Suite { +} diff --git a/user/test/com/google/gwt/emultest/java11/util/OptionalDoubleTest.java b/user/test/com/google/gwt/emultest/java11/util/OptionalDoubleTest.java new file mode 100644 index 0000000000..e8d9ac234d --- /dev/null +++ b/user/test/com/google/gwt/emultest/java11/util/OptionalDoubleTest.java @@ -0,0 +1,30 @@ +/* + * Copyright 2023 Google Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package com.google.gwt.emultest.java11.util; + +import com.google.gwt.emultest.java.util.EmulTestBase; + +import java.util.OptionalDouble; + +/** + * Tests for java.util.OptionalDouble Java 11 API emulation. + */ +public class OptionalDoubleTest extends EmulTestBase { + public void testIsEmpty() { + assertTrue(OptionalDouble.empty().isEmpty()); + assertFalse(OptionalDouble.of(78.9).isEmpty()); + } +} diff --git a/user/test/com/google/gwt/emultest/java11/util/OptionalIntTest.java b/user/test/com/google/gwt/emultest/java11/util/OptionalIntTest.java new file mode 100644 index 0000000000..a48fd60126 --- /dev/null +++ b/user/test/com/google/gwt/emultest/java11/util/OptionalIntTest.java @@ -0,0 +1,30 @@ +/* + * Copyright 2023 Google Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package com.google.gwt.emultest.java11.util; + +import com.google.gwt.emultest.java.util.EmulTestBase; + +import java.util.OptionalInt; + +/** + * Tests for java.util.OptionalInt Java 11 API emulation. + */ +public class OptionalIntTest extends EmulTestBase { + public void testIsEmpty() { + assertTrue(OptionalInt.empty().isEmpty()); + assertFalse(OptionalInt.of(456).isEmpty()); + } +} diff --git a/user/test/com/google/gwt/emultest/java11/util/OptionalLongTest.java b/user/test/com/google/gwt/emultest/java11/util/OptionalLongTest.java new file mode 100644 index 0000000000..7fd37b0015 --- /dev/null +++ b/user/test/com/google/gwt/emultest/java11/util/OptionalLongTest.java @@ -0,0 +1,30 @@ +/* + * Copyright 2023 Google Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package com.google.gwt.emultest.java11.util; + +import com.google.gwt.emultest.java.util.EmulTestBase; + +import java.util.OptionalLong; + +/** + * Tests for java.util.OptionalLong Java 11 API emulation. + */ +public class OptionalLongTest extends EmulTestBase { + public void testIsEmpty() { + assertTrue(OptionalLong.empty().isEmpty()); + assertFalse(OptionalLong.of(123L).isEmpty()); + } +} diff --git a/user/test/com/google/gwt/emultest/java11/util/OptionalTest.java b/user/test/com/google/gwt/emultest/java11/util/OptionalTest.java new file mode 100644 index 0000000000..b6c325ef75 --- /dev/null +++ b/user/test/com/google/gwt/emultest/java11/util/OptionalTest.java @@ -0,0 +1,30 @@ +/* + * Copyright 2023 Google Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package com.google.gwt.emultest.java11.util; + +import com.google.gwt.emultest.java.util.EmulTestBase; + +import java.util.Optional; + +/** + * Tests for java.util.Optional Java 11 API emulation. + */ +public class OptionalTest extends EmulTestBase { + public void testIsEmpty() { + assertTrue(Optional.empty().isEmpty()); + assertFalse(Optional.of(this).isEmpty()); + } +}