Download data/plugin/src/test/java/copilotj/util/FromToTest.java from introvoyz045/CopilotJ: direct link, hf CLI and curl.
- Browser
- Download file 1.45 kB
-
https://huggingface.co/datasets/introvoyz045/CopilotJ/resolve/main/data/plugin/src/test/java/copilotj/util/FromToTest.java
- Command line
-
hf download hf://datasets/introvoyz045/CopilotJ/data/plugin/src/test/java/copilotj/util/FromToTest.java
-
curl -L -o FromToTest.java https://huggingface.co/datasets/introvoyz045/CopilotJ/resolve/main/data/plugin/src/test/java/copilotj/util/FromToTest.java
1.45 kB
| /** | |
| * SPDX-FileCopyrightText: Copyright contributors to the CopilotJ project. | |
| * | |
| * SPDX-License-Identifier: Apache-2.0 | |
| */ | |
| package copilotj.util; | |
| import static org.junit.jupiter.api.Assertions.assertEquals; | |
| import static org.junit.jupiter.api.Assertions.assertNotSame; | |
| import static org.junit.jupiter.api.Assertions.assertNull; | |
| import org.junit.jupiter.api.Test; | |
| /** | |
| * Unit tests for {@link FromTo}, a minimal generic value pair with no validation | |
| * and no defined {@code equals}. | |
| */ | |
| public class FromToTest { | |
| public void holdsFromAndToValues() { | |
| final FromTo<Integer> ft = new FromTo<>(1, 2); | |
| assertEquals(1, ft.from); | |
| assertEquals(2, ft.to); | |
| } | |
| public void acceptsNullOnBothEnds() { | |
| final FromTo<String> ft = new FromTo<>(null, null); | |
| assertNull(ft.from); | |
| assertNull(ft.to); | |
| } | |
| public void acceptsNullOnOneEnd() { | |
| final FromTo<String> ft = new FromTo<>(null, "x"); | |
| assertNull(ft.from); | |
| assertEquals("x", ft.to); | |
| } | |
| public void worksAsStringPair() { | |
| final FromTo<String> ft = new FromTo<>("a", "b"); | |
| assertEquals("a", ft.from); | |
| assertEquals("b", ft.to); | |
| } | |
| public void distinctInstancesAreNotEqualByReference() { | |
| // FromTo defines no equals; two equal-content instances remain distinct references. | |
| final FromTo<Integer> a = new FromTo<>(1, 2); | |
| final FromTo<Integer> b = new FromTo<>(1, 2); | |
| assertNotSame(a, b); | |
| } | |
| } | |