diff options
author | janakr <janakr@google.com> | 2018-03-05 18:21:20 -0800 |
---|---|---|
committer | Copybara-Service <copybara-piper@google.com> | 2018-03-05 18:22:55 -0800 |
commit | 66c52e37d83371d93cea712c73f6b7355e0a0d0c (patch) | |
tree | 9cebbd6ddfec2188b8ac4b63a94541ec6237ba59 /src/test/java/com/google/devtools/build/lib | |
parent | 3e687ff5988aa6b3fb1582ade1362c80698a86ff (diff) |
@AutoCodec RepositoryName.
PiperOrigin-RevId: 187956593
Diffstat (limited to 'src/test/java/com/google/devtools/build/lib')
-rw-r--r-- | src/test/java/com/google/devtools/build/lib/skyframe/serialization/RepositoryNameCodecTest.java | 41 |
1 files changed, 9 insertions, 32 deletions
diff --git a/src/test/java/com/google/devtools/build/lib/skyframe/serialization/RepositoryNameCodecTest.java b/src/test/java/com/google/devtools/build/lib/skyframe/serialization/RepositoryNameCodecTest.java index f922e43d83..f9bfe33929 100644 --- a/src/test/java/com/google/devtools/build/lib/skyframe/serialization/RepositoryNameCodecTest.java +++ b/src/test/java/com/google/devtools/build/lib/skyframe/serialization/RepositoryNameCodecTest.java @@ -14,44 +14,21 @@ package com.google.devtools.build.lib.skyframe.serialization; -import static org.junit.Assert.fail; - -import com.google.common.collect.ImmutableMap; -import com.google.devtools.build.lib.cmdline.LabelSyntaxException; import com.google.devtools.build.lib.cmdline.RepositoryName; -import com.google.devtools.build.lib.cmdline.RepositoryNameCodec; -import com.google.devtools.build.lib.skyframe.serialization.testutils.AbstractObjectCodecTest; -import java.io.IOException; +import com.google.devtools.build.lib.skyframe.serialization.testutils.SerializationTester; import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.JUnit4; -/** Tests for {@link RepositoryNameCodec}. */ +/** Tests for codec for {@link RepositoryName}. */ @RunWith(JUnit4.class) -public class RepositoryNameCodecTest extends AbstractObjectCodecTest<RepositoryName> { - - // Set 0th byte (isMain) false, so that we'll try to read a string from the rest of the - // data and fail. - public static final byte[] INVALID_ENCODED_REPOSITORY_NAME = new byte[] {0, 10, 9, 8, 7}; - - public RepositoryNameCodecTest() throws LabelSyntaxException { - super( - new RepositoryNameCodec(), - RepositoryName.create(RepositoryName.DEFAULT.getName()), - RepositoryName.create(RepositoryName.MAIN.getName()), - RepositoryName.create("@externalandshouldntexistinthisworkspace")); - } - - // The default bad data test from AbstractObjectCodecTest doesn't play nice with boolean prefixed - // encodings. - @Override +public class RepositoryNameCodecTest { @Test - public void testDeserializeBadDataThrowsSerializationException() { - try { - fromBytes(new DeserializationContext(ImmutableMap.of()), INVALID_ENCODED_REPOSITORY_NAME); - fail("Expected exception"); - } catch (SerializationException | IOException e) { - // Expected. - } + public void testCodec() throws Exception { + new SerializationTester( + RepositoryName.create(RepositoryName.DEFAULT.getName()), + RepositoryName.create(RepositoryName.MAIN.getName()), + RepositoryName.create("@externalandshouldntexistinthisworkspace")) + .runTests(); } } |