aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFederico Tomassetti <federico@tomassetti.me>2018-02-22 20:56:12 +0100
committerFederico Tomassetti <federico@tomassetti.me>2018-02-22 20:56:12 +0100
commite4c464e6cef59d0b80043c2aa12d0371ba48b359 (patch)
tree0551982fcfe621bde07585699d72539dd382269a
parent3183227798ff938ce3879ae4498ad897de0c907b (diff)
downloadjavaparser-e4c464e6cef59d0b80043c2aa12d0371ba48b359.tar.gz
simple test for the ResolvedPrimitiveTypeTest
-rw-r--r--javaparser-symbol-solver-testing/src/test/java/com/github/javaparser/resolution/types/ResolvedPrimitiveTypeTest.java50
1 files changed, 50 insertions, 0 deletions
diff --git a/javaparser-symbol-solver-testing/src/test/java/com/github/javaparser/resolution/types/ResolvedPrimitiveTypeTest.java b/javaparser-symbol-solver-testing/src/test/java/com/github/javaparser/resolution/types/ResolvedPrimitiveTypeTest.java
new file mode 100644
index 000000000..494b2b2e9
--- /dev/null
+++ b/javaparser-symbol-solver-testing/src/test/java/com/github/javaparser/resolution/types/ResolvedPrimitiveTypeTest.java
@@ -0,0 +1,50 @@
+/*
+ * Copyright 2016 Federico Tomassetti
+ *
+ * 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.github.javaparser.resolution.types;
+
+import com.github.javaparser.symbolsolver.resolution.AbstractResolutionTest;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+
+public class ResolvedPrimitiveTypeTest extends AbstractResolutionTest {
+
+ private String exampleOfSwitch(ResolvedPrimitiveType rpt) {
+ switch (rpt) {
+ case INT:
+ return "I";
+ case BYTE:
+ return "B";
+ case DOUBLE:
+ return "D";
+ default:
+ return "U";
+ }
+ }
+
+ @Test
+ public void tryTheSwitchStatement() {
+ assertEquals("U", exampleOfSwitch(ResolvedPrimitiveType.BOOLEAN));
+ assertEquals("U", exampleOfSwitch(ResolvedPrimitiveType.CHAR));
+ assertEquals("B", exampleOfSwitch(ResolvedPrimitiveType.BYTE));
+ assertEquals("U", exampleOfSwitch(ResolvedPrimitiveType.SHORT));
+ assertEquals("I", exampleOfSwitch(ResolvedPrimitiveType.INT));
+ assertEquals("U", exampleOfSwitch(ResolvedPrimitiveType.LONG));
+ assertEquals("U", exampleOfSwitch(ResolvedPrimitiveType.FLOAT));
+ assertEquals("D", exampleOfSwitch(ResolvedPrimitiveType.DOUBLE));
+ }
+}