aboutsummaryrefslogtreecommitdiff
path: root/javatests
diff options
context:
space:
mode:
authorcushon <cushon@google.com>2018-12-14 16:03:33 -0800
committerLiam Miller-Cushon <cushon@google.com>2019-01-28 21:35:26 -0800
commit4897f9e0c5c9df43d6cfb86b71f6c37f0d6d0945 (patch)
tree319eb8c0dfcda3a0f046db901bba73bb1e9409ce /javatests
parent49fc8eaf64a247dc8e93127e7bb9344a1c7d5c6d (diff)
downloadturbine-4897f9e0c5c9df43d6cfb86b71f6c37f0d6d0945.tar.gz
Miscellaneous cleanups
MOE_MIGRATED_REVID=225619145
Diffstat (limited to 'javatests')
-rw-r--r--javatests/com/google/turbine/binder/BinderErrorTest.java5
-rw-r--r--javatests/com/google/turbine/binder/BinderTest.java17
-rw-r--r--javatests/com/google/turbine/binder/ClassPathBinderTest.java11
-rw-r--r--javatests/com/google/turbine/binder/JimageClassBinderTest.java3
-rw-r--r--javatests/com/google/turbine/binder/bytecode/BytecodeBoundClassTest.java6
-rw-r--r--javatests/com/google/turbine/deps/DependenciesTest.java34
-rw-r--r--javatests/com/google/turbine/lower/IntegrationTestSupport.java7
-rw-r--r--javatests/com/google/turbine/lower/LowerTest.java6
-rw-r--r--javatests/com/google/turbine/lower/ModuleIntegrationTest.java5
-rw-r--r--javatests/com/google/turbine/main/MainTest.java18
-rw-r--r--javatests/com/google/turbine/model/ConstTest.java14
-rw-r--r--javatests/com/google/turbine/parse/ParseErrorTest.java31
12 files changed, 84 insertions, 73 deletions
diff --git a/javatests/com/google/turbine/binder/BinderErrorTest.java b/javatests/com/google/turbine/binder/BinderErrorTest.java
index bc61e76..737339b 100644
--- a/javatests/com/google/turbine/binder/BinderErrorTest.java
+++ b/javatests/com/google/turbine/binder/BinderErrorTest.java
@@ -26,7 +26,6 @@ import com.google.turbine.diag.TurbineError;
import com.google.turbine.parse.Parser;
import com.google.turbine.tree.Tree.CompUnit;
import java.util.Arrays;
-import java.util.Collections;
import java.util.Optional;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -522,13 +521,13 @@ public class BinderErrorTest {
try {
Binder.bind(
ImmutableList.of(parseLines(source)),
- ClassPathBinder.bindClasspath(Collections.emptyList()),
+ ClassPathBinder.bindClasspath(ImmutableList.of()),
TURBINE_BOOTCLASSPATH,
/* moduleVersion=*/ Optional.empty())
.units();
fail(Joiner.on('\n').join(source));
} catch (TurbineError e) {
- assertThat(e.getMessage()).isEqualTo(lines(expected));
+ assertThat(e).hasMessageThat().isEqualTo(lines(expected));
}
}
diff --git a/javatests/com/google/turbine/binder/BinderTest.java b/javatests/com/google/turbine/binder/BinderTest.java
index 8bf4cd3..4b1e890 100644
--- a/javatests/com/google/turbine/binder/BinderTest.java
+++ b/javatests/com/google/turbine/binder/BinderTest.java
@@ -37,7 +37,6 @@ import java.io.OutputStream;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.ArrayList;
-import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Optional;
@@ -76,7 +75,7 @@ public class BinderTest {
ImmutableMap<ClassSymbol, SourceTypeBoundClass> bound =
Binder.bind(
units,
- ClassPathBinder.bindClasspath(Collections.emptyList()),
+ ClassPathBinder.bindClasspath(ImmutableList.of()),
TURBINE_BOOTCLASSPATH,
/* moduleVersion=*/ Optional.empty())
.units();
@@ -122,7 +121,7 @@ public class BinderTest {
ImmutableMap<ClassSymbol, SourceTypeBoundClass> bound =
Binder.bind(
units,
- ClassPathBinder.bindClasspath(Collections.emptyList()),
+ ClassPathBinder.bindClasspath(ImmutableList.of()),
TURBINE_BOOTCLASSPATH,
/* moduleVersion=*/ Optional.empty())
.units();
@@ -162,7 +161,7 @@ public class BinderTest {
ImmutableMap<ClassSymbol, SourceTypeBoundClass> bound =
Binder.bind(
units,
- ClassPathBinder.bindClasspath(Collections.emptyList()),
+ ClassPathBinder.bindClasspath(ImmutableList.of()),
TURBINE_BOOTCLASSPATH,
/* moduleVersion=*/ Optional.empty())
.units();
@@ -192,12 +191,12 @@ public class BinderTest {
try {
Binder.bind(
units,
- ClassPathBinder.bindClasspath(Collections.emptyList()),
+ ClassPathBinder.bindClasspath(ImmutableList.of()),
TURBINE_BOOTCLASSPATH,
/* moduleVersion=*/ Optional.empty());
fail();
} catch (TurbineError e) {
- assertThat(e.getMessage()).contains("cycle in class hierarchy: a.A -> b.B -> a.A");
+ assertThat(e).hasMessageThat().contains("cycle in class hierarchy: a.A -> b.B -> a.A");
}
}
@@ -213,7 +212,7 @@ public class BinderTest {
ImmutableMap<ClassSymbol, SourceTypeBoundClass> bound =
Binder.bind(
units,
- ClassPathBinder.bindClasspath(Collections.emptyList()),
+ ClassPathBinder.bindClasspath(ImmutableList.of()),
TURBINE_BOOTCLASSPATH,
/* moduleVersion=*/ Optional.empty())
.units();
@@ -242,7 +241,7 @@ public class BinderTest {
ImmutableMap<ClassSymbol, SourceTypeBoundClass> bound =
Binder.bind(
units,
- ClassPathBinder.bindClasspath(Collections.emptyList()),
+ ClassPathBinder.bindClasspath(ImmutableList.of()),
TURBINE_BOOTCLASSPATH,
/* moduleVersion=*/ Optional.empty())
.units();
@@ -306,7 +305,7 @@ public class BinderTest {
ImmutableMap<ClassSymbol, SourceTypeBoundClass> bound =
Binder.bind(
units,
- ClassPathBinder.bindClasspath(Collections.emptyList()),
+ ClassPathBinder.bindClasspath(ImmutableList.of()),
TURBINE_BOOTCLASSPATH,
/* moduleVersion=*/ Optional.empty())
.units();
diff --git a/javatests/com/google/turbine/binder/ClassPathBinderTest.java b/javatests/com/google/turbine/binder/ClassPathBinderTest.java
index 0b063d4..3f41706 100644
--- a/javatests/com/google/turbine/binder/ClassPathBinderTest.java
+++ b/javatests/com/google/turbine/binder/ClassPathBinderTest.java
@@ -27,6 +27,7 @@ import static org.junit.Assert.fail;
import com.google.common.base.VerifyException;
import com.google.common.collect.ImmutableList;
import com.google.common.io.ByteStreams;
+import com.google.common.io.MoreFiles;
import com.google.turbine.binder.bound.EnumConstantValue;
import com.google.turbine.binder.bound.TypeBoundClass;
import com.google.turbine.binder.bytecode.BytecodeBoundClass;
@@ -43,7 +44,6 @@ import com.google.turbine.type.AnnoInfo;
import com.google.turbine.type.Type.ClassTy;
import java.io.IOError;
import java.io.IOException;
-import java.nio.file.Files;
import java.nio.file.Path;
import org.junit.Rule;
import org.junit.Test;
@@ -85,7 +85,7 @@ public class ClassPathBinderTest {
.isEqualTo(TurbineTyKind.ANNOTATION);
c = env.get(new ClassSymbol("java/util/ArrayList"));
- assertThat((c.access() & TurbineFlag.ACC_PUBLIC) == TurbineFlag.ACC_PUBLIC).isTrue();
+ assertThat((c.access() & TurbineFlag.ACC_PUBLIC)).isEqualTo(TurbineFlag.ACC_PUBLIC);
assertThat(c.superclass()).isEqualTo(new ClassSymbol("java/util/AbstractList"));
assertThat(c.interfaces()).contains(new ClassSymbol("java/util/List"));
assertThat(c.owner()).isNull();
@@ -143,7 +143,8 @@ public class ClassPathBinderTest {
c.owner();
fail();
} catch (VerifyException e) {
- assertThat(e.getMessage())
+ assertThat(e)
+ .hasMessageThat()
.contains("expected class data for java/util/List, saw java/util/ArrayList instead");
}
}
@@ -151,13 +152,13 @@ public class ClassPathBinderTest {
@Test
public void nonJarFile() throws Exception {
Path lib = temporaryFolder.newFile("NOT_A_JAR").toPath();
- Files.write(lib, "hello".getBytes(UTF_8));
+ MoreFiles.asCharSink(lib, UTF_8).write("hello");
try {
ClassPathBinder.bindClasspath(ImmutableList.of(lib));
fail();
} catch (IOException e) {
- assertThat(e.getMessage()).contains("NOT_A_JAR");
+ assertThat(e).hasMessageThat().contains("NOT_A_JAR");
}
}
}
diff --git a/javatests/com/google/turbine/binder/JimageClassBinderTest.java b/javatests/com/google/turbine/binder/JimageClassBinderTest.java
index bbcb245..11d6823 100644
--- a/javatests/com/google/turbine/binder/JimageClassBinderTest.java
+++ b/javatests/com/google/turbine/binder/JimageClassBinderTest.java
@@ -16,6 +16,7 @@
package com.google.turbine.binder;
+import static com.google.common.base.StandardSystemProperty.JAVA_CLASS_VERSION;
import static com.google.common.collect.Iterables.getOnlyElement;
import static com.google.common.truth.Truth.assertThat;
@@ -34,7 +35,7 @@ import org.junit.runners.JUnit4;
public class JimageClassBinderTest {
@Test
public void testDefaultJimage() throws IOException {
- if (Double.parseDouble(System.getProperty("java.class.version")) < 53) {
+ if (Double.parseDouble(JAVA_CLASS_VERSION.value()) < 53) {
// only run on JDK 9 and later
return;
}
diff --git a/javatests/com/google/turbine/binder/bytecode/BytecodeBoundClassTest.java b/javatests/com/google/turbine/binder/bytecode/BytecodeBoundClassTest.java
index 4e3ec9a..2a0de48 100644
--- a/javatests/com/google/turbine/binder/bytecode/BytecodeBoundClassTest.java
+++ b/javatests/com/google/turbine/binder/bytecode/BytecodeBoundClassTest.java
@@ -24,7 +24,7 @@ import static java.util.Objects.requireNonNull;
import com.google.common.collect.ImmutableMap;
import com.google.common.io.ByteStreams;
-import com.google.turbine.binder.bound.ClassValue;
+import com.google.turbine.binder.bound.TurbineClassValue;
import com.google.turbine.binder.bound.TypeBoundClass;
import com.google.turbine.binder.bound.TypeBoundClass.MethodInfo;
import com.google.turbine.binder.env.CompoundEnv;
@@ -110,9 +110,9 @@ public class BytecodeBoundClassTest {
BytecodeBoundClass c = getBytecodeBoundClass(VoidAnno.class);
assertThat(c.methods()).hasSize(2);
- assertThat(((ClassValue) c.methods().get(0).defaultValue()).type().tyKind())
+ assertThat(((TurbineClassValue) c.methods().get(0).defaultValue()).type().tyKind())
.isEqualTo(Type.TyKind.VOID_TY);
- assertThat(((ClassValue) c.methods().get(1).defaultValue()).type().tyKind())
+ assertThat(((TurbineClassValue) c.methods().get(1).defaultValue()).type().tyKind())
.isEqualTo(Type.TyKind.ARRAY_TY);
}
diff --git a/javatests/com/google/turbine/deps/DependenciesTest.java b/javatests/com/google/turbine/deps/DependenciesTest.java
index 4c2362f..b1da209 100644
--- a/javatests/com/google/turbine/deps/DependenciesTest.java
+++ b/javatests/com/google/turbine/deps/DependenciesTest.java
@@ -22,6 +22,7 @@ import com.google.common.base.Joiner;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableSet;
+import com.google.common.collect.Streams;
import com.google.turbine.binder.Binder;
import com.google.turbine.binder.Binder.BindingResult;
import com.google.turbine.binder.ClassPathBinder;
@@ -47,7 +48,6 @@ import java.util.Optional;
import java.util.jar.JarEntry;
import java.util.jar.JarOutputStream;
import java.util.stream.Collectors;
-import java.util.stream.StreamSupport;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TemporaryFolder;
@@ -116,7 +116,7 @@ public class DependenciesTest {
}
private Map<Path, DepsProto.Dependency.Kind> depsMap(DepsProto.Dependencies deps) {
- return StreamSupport.stream(deps.getDependencyList().spliterator(), false)
+ return Streams.stream(deps.getDependencyList())
.collect(Collectors.toMap(d -> Paths.get(d.getPath()), DepsProto.Dependency::getKind));
}
@@ -130,7 +130,7 @@ public class DependenciesTest {
.addSourceLines("Test.java", "class Test extends A {}")
.run();
- assertThat(depsMap(deps)).isEqualTo(ImmutableMap.of(liba, DepsProto.Dependency.Kind.EXPLICIT));
+ assertThat(depsMap(deps)).containsExactly(liba, DepsProto.Dependency.Kind.EXPLICIT);
}
@Test
@@ -156,7 +156,7 @@ public class DependenciesTest {
.addSourceLines("Test.java", "class Test extends B {}")
.run();
- assertThat(depsMap(deps)).isEqualTo(ImmutableMap.of(libb, DepsProto.Dependency.Kind.EXPLICIT));
+ assertThat(depsMap(deps)).containsExactly(libb, DepsProto.Dependency.Kind.EXPLICIT);
}
@Test
@@ -184,10 +184,8 @@ public class DependenciesTest {
"}")
.run();
assertThat(depsMap(deps))
- .isEqualTo(
- ImmutableMap.of(
- libb, DepsProto.Dependency.Kind.EXPLICIT,
- liba, DepsProto.Dependency.Kind.EXPLICIT));
+ .containsExactly(
+ libb, DepsProto.Dependency.Kind.EXPLICIT, liba, DepsProto.Dependency.Kind.EXPLICIT);
}
@Test
@@ -227,11 +225,13 @@ public class DependenciesTest {
"class Test extends B {}")
.run();
assertThat(depsMap(deps))
- .isEqualTo(
- ImmutableMap.of(
- libi, DepsProto.Dependency.Kind.EXPLICIT,
- libb, DepsProto.Dependency.Kind.EXPLICIT,
- liba, DepsProto.Dependency.Kind.EXPLICIT));
+ .containsExactly(
+ libi,
+ DepsProto.Dependency.Kind.EXPLICIT,
+ libb,
+ DepsProto.Dependency.Kind.EXPLICIT,
+ liba,
+ DepsProto.Dependency.Kind.EXPLICIT);
}
{
// partial classpath
@@ -244,10 +244,8 @@ public class DependenciesTest {
"class Test extends B {}")
.run();
assertThat(depsMap(deps))
- .isEqualTo(
- ImmutableMap.of(
- libb, DepsProto.Dependency.Kind.EXPLICIT,
- liba, DepsProto.Dependency.Kind.EXPLICIT));
+ .containsExactly(
+ libb, DepsProto.Dependency.Kind.EXPLICIT, liba, DepsProto.Dependency.Kind.EXPLICIT);
}
}
@@ -260,7 +258,7 @@ public class DependenciesTest {
ImmutableSet<String> directJars = ImmutableSet.of();
ImmutableList<String> depsArtifacts = ImmutableList.of();
assertThat(Dependencies.reduceClasspath(classpath, directJars, depsArtifacts))
- .isEqualTo(classpath);
+ .containsExactlyElementsIn(classpath);
}
@Test
diff --git a/javatests/com/google/turbine/lower/IntegrationTestSupport.java b/javatests/com/google/turbine/lower/IntegrationTestSupport.java
index c039241..a3c6c37 100644
--- a/javatests/com/google/turbine/lower/IntegrationTestSupport.java
+++ b/javatests/com/google/turbine/lower/IntegrationTestSupport.java
@@ -25,6 +25,7 @@ import static java.util.stream.Collectors.toList;
import com.google.common.base.Joiner;
import com.google.common.base.Splitter;
import com.google.common.collect.ImmutableList;
+import com.google.common.io.MoreFiles;
import com.google.common.jimfs.Configuration;
import com.google.common.jimfs.Jimfs;
import com.google.turbine.binder.Binder;
@@ -344,14 +345,14 @@ public class IntegrationTestSupport {
if (annos == null) {
return;
}
- annos.stream().forEach(a -> collectTypesFromAnnotation(types, a));
+ annos.forEach(a -> collectTypesFromAnnotation(types, a));
}
private static void addTypesInAnnotations(Set<String> types, List<AnnotationNode> annos) {
if (annos == null) {
return;
}
- annos.stream().forEach(a -> collectTypesFromAnnotation(types, a));
+ annos.forEach(a -> collectTypesFromAnnotation(types, a));
}
private static void collectTypesFromAnnotation(Set<String> types, AnnotationNode a) {
@@ -476,7 +477,7 @@ public class IntegrationTestSupport {
if (path.getParent() != null) {
Files.createDirectories(path.getParent());
}
- Files.write(path, entry.getValue().getBytes(UTF_8));
+ MoreFiles.asCharSink(path, UTF_8).write(entry.getValue());
inputs.add(path);
}
diff --git a/javatests/com/google/turbine/lower/LowerTest.java b/javatests/com/google/turbine/lower/LowerTest.java
index ef070f9..0de55c3 100644
--- a/javatests/com/google/turbine/lower/LowerTest.java
+++ b/javatests/com/google/turbine/lower/LowerTest.java
@@ -431,7 +431,7 @@ public class LowerTest {
}
},
0);
- assertThat((acc[0] & Opcodes.ACC_DEPRECATED) == Opcodes.ACC_DEPRECATED).isTrue();
+ assertThat((acc[0] & Opcodes.ACC_DEPRECATED)).isEqualTo(Opcodes.ACC_DEPRECATED);
}
@Test
@@ -635,8 +635,8 @@ public class LowerTest {
}
},
0);
- assertThat((testAccess[0] & TurbineFlag.ACC_PUBLIC) == TurbineFlag.ACC_PUBLIC).isTrue();
- assertThat((testAccess[0] & TurbineFlag.ACC_PROTECTED) == TurbineFlag.ACC_PROTECTED).isFalse();
+ assertThat((testAccess[0] & TurbineFlag.ACC_PUBLIC)).isEqualTo(TurbineFlag.ACC_PUBLIC);
+ assertThat((testAccess[0] & TurbineFlag.ACC_PROTECTED)).isNotEqualTo(TurbineFlag.ACC_PROTECTED);
}
static String lines(String... lines) {
diff --git a/javatests/com/google/turbine/lower/ModuleIntegrationTest.java b/javatests/com/google/turbine/lower/ModuleIntegrationTest.java
index 4067bd1..a72c971 100644
--- a/javatests/com/google/turbine/lower/ModuleIntegrationTest.java
+++ b/javatests/com/google/turbine/lower/ModuleIntegrationTest.java
@@ -16,6 +16,7 @@
package com.google.turbine.lower;
+import static com.google.common.base.StandardSystemProperty.JAVA_CLASS_VERSION;
import static com.google.common.collect.ImmutableMap.toImmutableMap;
import static java.nio.charset.StandardCharsets.UTF_8;
import static java.util.stream.Collectors.toList;
@@ -61,7 +62,7 @@ public class ModuleIntegrationTest {
@Test
public void test() throws Exception {
- if (Double.parseDouble(System.getProperty("java.class.version")) < 53) {
+ if (Double.parseDouble(JAVA_CLASS_VERSION.value()) < 53) {
// only run on JDK 9 and later
return;
}
@@ -97,7 +98,7 @@ public class ModuleIntegrationTest {
IntegrationTestSupport.runTurbine(
input.sources,
classpathJar,
- Double.parseDouble(System.getProperty("java.class.version")) < 54
+ Double.parseDouble(JAVA_CLASS_VERSION.value()) < 54
? JimageClassBinder.bindDefault()
: CtSymClassBinder.bind("9"),
Optional.of("42"));
diff --git a/javatests/com/google/turbine/main/MainTest.java b/javatests/com/google/turbine/main/MainTest.java
index 654a89b..65f3167 100644
--- a/javatests/com/google/turbine/main/MainTest.java
+++ b/javatests/com/google/turbine/main/MainTest.java
@@ -16,6 +16,7 @@
package com.google.turbine.main;
+import static com.google.common.base.StandardSystemProperty.JAVA_CLASS_VERSION;
import static com.google.common.truth.Truth.assertThat;
import static com.google.turbine.testing.TestClassPaths.optionsWithBootclasspath;
import static java.nio.charset.StandardCharsets.UTF_8;
@@ -23,6 +24,7 @@ import static org.junit.Assert.fail;
import com.google.common.collect.ImmutableList;
import com.google.common.io.ByteStreams;
+import com.google.common.io.MoreFiles;
import com.google.turbine.diag.TurbineError;
import com.google.turbine.options.TurbineOptions;
import java.io.IOException;
@@ -71,14 +73,14 @@ public class MainTest {
.build());
fail();
} catch (TurbineError e) {
- assertThat(e.getMessage()).contains("error: duplicate declaration of Test");
+ assertThat(e).hasMessageThat().contains("error: duplicate declaration of Test");
}
}
@Test
public void packageInfo() throws IOException {
Path src = temporaryFolder.newFile("package-info.jar").toPath();
- Files.write(src, "@Deprecated package test;".getBytes(UTF_8));
+ MoreFiles.asCharSink(src, UTF_8).write("@Deprecated package test;");
Path output = temporaryFolder.newFile("output.jar").toPath();
@@ -130,7 +132,7 @@ public class MainTest {
@Test
public void moduleInfos() throws IOException {
- if (Double.parseDouble(System.getProperty("java.class.version")) < 53) {
+ if (Double.parseDouble(JAVA_CLASS_VERSION.value()) < 53) {
// only run on JDK 9 and later
return;
}
@@ -144,7 +146,7 @@ public class MainTest {
}
Path src = temporaryFolder.newFile("module-info.java").toPath();
- Files.write(src, "module baz {}".getBytes(UTF_8));
+ MoreFiles.asCharSink(src, UTF_8).write("module baz {}");
Path output = temporaryFolder.newFile("output.jar").toPath();
@@ -166,7 +168,7 @@ public class MainTest {
@Test
public void testManifest() throws IOException {
Path src = temporaryFolder.newFile("Foo.java").toPath();
- Files.write(src, "class Foo {}".getBytes(UTF_8));
+ MoreFiles.asCharSink(src, UTF_8).write("class Foo {}");
Path output = temporaryFolder.newFile("output.jar").toPath();
@@ -195,7 +197,7 @@ public class MainTest {
public void emptyBootClassPath() throws IOException {
Path src = temporaryFolder.newFolder().toPath().resolve("java/lang/Object.java");
Files.createDirectories(src.getParent());
- Files.write(src, "package java.lang; public class Object {}".getBytes(UTF_8));
+ MoreFiles.asCharSink(src, UTF_8).write("package java.lang; public class Object {}");
Path output = temporaryFolder.newFile("output.jar").toPath();
@@ -214,7 +216,7 @@ public class MainTest {
@Test
public void emptyBootClassPath_noJavaLang() throws IOException {
Path src = temporaryFolder.newFile("Test.java").toPath();
- Files.write(src, "public class Test {}".getBytes(UTF_8));
+ MoreFiles.asCharSink(src, UTF_8).write("public class Test {}");
Path output = temporaryFolder.newFile("output.jar").toPath();
@@ -233,7 +235,7 @@ public class MainTest {
@Test
public void usage() throws IOException {
Path src = temporaryFolder.newFile("Test.java").toPath();
- Files.write(src, "public class Test {}".getBytes(UTF_8));
+ MoreFiles.asCharSink(src, UTF_8).write("public class Test {}");
try {
Main.compile(optionsWithBootclasspath().addSources(ImmutableList.of(src.toString())).build());
diff --git a/javatests/com/google/turbine/model/ConstTest.java b/javatests/com/google/turbine/model/ConstTest.java
index 7940124..a64d0bf 100644
--- a/javatests/com/google/turbine/model/ConstTest.java
+++ b/javatests/com/google/turbine/model/ConstTest.java
@@ -20,7 +20,7 @@ import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import com.google.common.testing.EqualsTester;
import com.google.turbine.binder.bound.AnnotationValue;
-import com.google.turbine.binder.bound.ClassValue;
+import com.google.turbine.binder.bound.TurbineClassValue;
import com.google.turbine.binder.sym.ClassSymbol;
import com.google.turbine.type.Type.ClassTy;
import com.google.turbine.type.Type.PrimTy;
@@ -72,14 +72,14 @@ public class ConstTest {
new AnnotationValue(
new ClassSymbol("test/Anno"), ImmutableMap.of("value", new Const.IntValue(4))))
.addEqualityGroup(
- new ClassValue(ClassTy.asNonParametricClassTy(new ClassSymbol("test/Clazz"))),
- new ClassValue(ClassTy.asNonParametricClassTy(new ClassSymbol("test/Clazz"))))
+ new TurbineClassValue(ClassTy.asNonParametricClassTy(new ClassSymbol("test/Clazz"))),
+ new TurbineClassValue(ClassTy.asNonParametricClassTy(new ClassSymbol("test/Clazz"))))
.addEqualityGroup(
- new ClassValue(ClassTy.asNonParametricClassTy(new ClassSymbol("test/Other"))),
- new ClassValue(ClassTy.asNonParametricClassTy(new ClassSymbol("test/Other"))))
+ new TurbineClassValue(ClassTy.asNonParametricClassTy(new ClassSymbol("test/Other"))),
+ new TurbineClassValue(ClassTy.asNonParametricClassTy(new ClassSymbol("test/Other"))))
.addEqualityGroup(
- new ClassValue(PrimTy.create(TurbineConstantTypeKind.INT, ImmutableList.of())),
- new ClassValue(PrimTy.create(TurbineConstantTypeKind.INT, ImmutableList.of())))
+ new TurbineClassValue(PrimTy.create(TurbineConstantTypeKind.INT, ImmutableList.of())),
+ new TurbineClassValue(PrimTy.create(TurbineConstantTypeKind.INT, ImmutableList.of())))
.testEquals();
}
}
diff --git a/javatests/com/google/turbine/parse/ParseErrorTest.java b/javatests/com/google/turbine/parse/ParseErrorTest.java
index d1eb9c4..49fb273 100644
--- a/javatests/com/google/turbine/parse/ParseErrorTest.java
+++ b/javatests/com/google/turbine/parse/ParseErrorTest.java
@@ -40,7 +40,7 @@ public class ParseErrorTest {
parser.expression();
fail("expected parsing to fail");
} catch (TurbineError e) {
- assertThat(e.getMessage()).contains("invalid literal");
+ assertThat(e).hasMessageThat().contains("invalid literal");
}
}
@@ -54,7 +54,7 @@ public class ParseErrorTest {
parser.expression();
fail("expected parsing to fail");
} catch (TurbineError e) {
- assertThat(e.getMessage()).contains("invalid literal");
+ assertThat(e).hasMessageThat().contains("invalid literal");
}
}
@@ -65,7 +65,8 @@ public class ParseErrorTest {
Parser.parse(input);
fail("expected parsing to fail");
} catch (TurbineError e) {
- assertThat(e.getMessage())
+ assertThat(e)
+ .hasMessageThat()
.isEqualTo(
lines(
"<>:1: error: unexpected token: void",
@@ -81,7 +82,8 @@ public class ParseErrorTest {
Parser.parse(input);
fail("expected parsing to fail");
} catch (TurbineError e) {
- assertThat(e.getMessage())
+ assertThat(e)
+ .hasMessageThat()
.isEqualTo(
lines(
"<>:1: error: unexpected identifier 'clas'", //
@@ -97,7 +99,8 @@ public class ParseErrorTest {
Parser.parse(input);
fail("expected parsing to fail");
} catch (TurbineError e) {
- assertThat(e.getMessage())
+ assertThat(e)
+ .hasMessageThat()
.isEqualTo(
lines(
"<>:2: error: unexpected end of input", //
@@ -113,7 +116,8 @@ public class ParseErrorTest {
Parser.parse(input);
fail("expected parsing to fail");
} catch (TurbineError e) {
- assertThat(e.getMessage())
+ assertThat(e)
+ .hasMessageThat()
.isEqualTo(
lines(
"<>:1: error: invalid annotation argument", //
@@ -129,7 +133,8 @@ public class ParseErrorTest {
Parser.parse(input);
fail("expected parsing to fail");
} catch (TurbineError e) {
- assertThat(e.getMessage())
+ assertThat(e)
+ .hasMessageThat()
.isEqualTo(
lines(
"<>:1: error: unexpected end of input", //
@@ -145,7 +150,8 @@ public class ParseErrorTest {
Parser.parse(input);
fail("expected parsing to fail");
} catch (TurbineError e) {
- assertThat(e.getMessage())
+ assertThat(e)
+ .hasMessageThat()
.isEqualTo(
lines(
"<>:1: error: unexpected end of input", //
@@ -161,7 +167,8 @@ public class ParseErrorTest {
Parser.parse(input);
fail("expected parsing to fail");
} catch (TurbineError e) {
- assertThat(e.getMessage())
+ assertThat(e)
+ .hasMessageThat()
.isEqualTo(
lines(
"<>:1: error: unterminated string literal", //
@@ -177,7 +184,8 @@ public class ParseErrorTest {
Parser.parse(input);
fail("expected parsing to fail");
} catch (TurbineError e) {
- assertThat(e.getMessage())
+ assertThat(e)
+ .hasMessageThat()
.isEqualTo(
lines(
"<>:1: error: empty char literal", //
@@ -193,7 +201,8 @@ public class ParseErrorTest {
Parser.parse(input);
fail("expected parsing to fail");
} catch (TurbineError e) {
- assertThat(e.getMessage())
+ assertThat(e)
+ .hasMessageThat()
.isEqualTo(
lines(
"<>:1: error: unterminated char literal", //