public class CoderProperties extends Object
Coder tests. These are implemented with junit assertions
rather than as predicates for the sake of error messages.
We serialize and deserialize the coder to make sure that any state information required by the coder is preserved. This causes tests written such that coders that lose information during serialization or change state during encoding/decoding will fail.
| Modifier and Type | Field and Description |
|---|---|
static List<Coder.Context> |
ALL_CONTEXTS
All the contexts, for use in test cases.
|
| Constructor and Description |
|---|
CoderProperties() |
| Modifier and Type | Method and Description |
|---|---|
static <T> void |
coderAllowsEncoding(Coder<T> coder,
String encodingId) |
static <T> void |
coderConsistentWithEquals(Coder<T> coder,
T value1,
T value2) |
static <T> void |
coderConsistentWithEqualsInContext(Coder<T> coder,
Coder.Context context,
T value1,
T value2) |
static <T,CollectionT extends Collection<T>> |
coderDecodeEncodeContentsEqual(Coder<CollectionT> coder,
CollectionT value)
Verifies that for the given
Coder<Collection<T>>,
and value of type Collection<T>, encoding followed by decoding yields an
equal value of type Collection<T>, in any Coder.Context. |
static <T,CollectionT extends Collection<T>> |
coderDecodeEncodeContentsEqualInContext(Coder<CollectionT> coder,
Coder.Context context,
CollectionT value)
Verifies that for the given
Coder<Collection<T>>,
and value of type Collection<T>, encoding followed by decoding yields an
equal value of type Collection<T>, in the given Coder.Context. |
static <T,IterableT extends Iterable<T>> |
coderDecodeEncodeContentsInSameOrder(Coder<IterableT> coder,
IterableT value)
Verifies that for the given
Coder<Collection<T>>,
and value of type Collection<T>, encoding followed by decoding yields an
equal value of type Collection<T>, in any Coder.Context. |
static <T,IterableT extends Iterable<T>> |
coderDecodeEncodeContentsInSameOrderInContext(Coder<IterableT> coder,
Coder.Context context,
IterableT value)
Verifies that for the given
Coder<Iterable<T>>,
and value of type Iterable<T>, encoding followed by decoding yields an
equal value of type Collection<T>, in the given Coder.Context. |
static <T> void |
coderDecodeEncodeEqual(Coder<T> coder,
T value)
Verifies that for the given
Coder<T>,
and value of type T, encoding followed by decoding yields an
equal value of type T, in any Coder.Context. |
static <T> void |
coderDecodeEncodeEqualInContext(Coder<T> coder,
Coder.Context context,
T value)
Verifies that for the given
Coder<T>, Coder.Context,
and value of type T, encoding followed by decoding yields an
equal value of type T. |
static <T> void |
coderDecodesBase64(Coder<T> coder,
List<String> base64Encodings,
List<T> values) |
static <T> void |
coderDecodesBase64(Coder<T> coder,
String base64Encoding,
T value) |
static <T,IterableT extends Iterable<T>> |
coderDecodesBase64ContentsEqual(Coder<IterableT> coder,
List<String> base64Encodings,
List<IterableT> expected) |
static <T,IterableT extends Iterable<T>> |
coderDecodesBase64ContentsEqual(Coder<IterableT> coder,
String base64Encoding,
IterableT expected) |
static <T> void |
coderDeterministic(Coder<T> coder,
T value1,
T value2)
Verifies that for the given
Coder<T>, and values of
type T, if the values are equal then the encoded bytes are equal, in any
Coder.Context. |
static <T> void |
coderDeterministicInContext(Coder<T> coder,
Coder.Context context,
T value1,
T value2)
Verifies that for the given
Coder<T>, Coder.Context, and values of
type T, if the values are equal then the encoded bytes are equal. |
static <T> void |
coderEncodesBase64(Coder<T> coder,
List<T> values,
List<String> base64Encodings) |
static <T> void |
coderEncodesBase64(Coder<T> coder,
T value,
String base64Encoding) |
static <T> void |
coderHasEncodingId(Coder<T> coder,
String encodingId) |
static <T> void |
coderSerializable(Coder<T> coder) |
static <T> void |
structuralValueConsistentWithEquals(Coder<T> coder,
T value1,
T value2) |
static <T> void |
structuralValueConsistentWithEqualsInContext(Coder<T> coder,
Coder.Context context,
T value1,
T value2) |
public static final List<Coder.Context> ALL_CONTEXTS
public static <T> void coderDeterministic(Coder<T> coder, T value1, T value2) throws Exception
Coder<T>, and values of
type T, if the values are equal then the encoded bytes are equal, in any
Coder.Context.Exceptionpublic static <T> void coderDeterministicInContext(Coder<T> coder, Coder.Context context, T value1, T value2) throws Exception
Coder<T>, Coder.Context, and values of
type T, if the values are equal then the encoded bytes are equal.Exceptionpublic static <T> void coderDecodeEncodeEqual(Coder<T> coder, T value) throws Exception
Coder<T>,
and value of type T, encoding followed by decoding yields an
equal value of type T, in any Coder.Context.Exceptionpublic static <T> void coderDecodeEncodeEqualInContext(Coder<T> coder, Coder.Context context, T value) throws Exception
Coder<T>, Coder.Context,
and value of type T, encoding followed by decoding yields an
equal value of type T.Exceptionpublic static <T,CollectionT extends Collection<T>> void coderDecodeEncodeContentsEqual(Coder<CollectionT> coder, CollectionT value) throws Exception
Coder<Collection<T>>,
and value of type Collection<T>, encoding followed by decoding yields an
equal value of type Collection<T>, in any Coder.Context.Exceptionpublic static <T,CollectionT extends Collection<T>> void coderDecodeEncodeContentsEqualInContext(Coder<CollectionT> coder, Coder.Context context, CollectionT value) throws Exception
Coder<Collection<T>>,
and value of type Collection<T>, encoding followed by decoding yields an
equal value of type Collection<T>, in the given Coder.Context.Exceptionpublic static <T,IterableT extends Iterable<T>> void coderDecodeEncodeContentsInSameOrder(Coder<IterableT> coder, IterableT value) throws Exception
Coder<Collection<T>>,
and value of type Collection<T>, encoding followed by decoding yields an
equal value of type Collection<T>, in any Coder.Context.Exceptionpublic static <T,IterableT extends Iterable<T>> void coderDecodeEncodeContentsInSameOrderInContext(Coder<IterableT> coder, Coder.Context context, IterableT value) throws Exception
Coder<Iterable<T>>,
and value of type Iterable<T>, encoding followed by decoding yields an
equal value of type Collection<T>, in the given Coder.Context.Exceptionpublic static <T> void coderSerializable(Coder<T> coder)
public static <T> void coderConsistentWithEquals(Coder<T> coder, T value1, T value2) throws Exception
Exceptionpublic static <T> void coderConsistentWithEqualsInContext(Coder<T> coder, Coder.Context context, T value1, T value2) throws Exception
Exceptionpublic static <T> void coderHasEncodingId(Coder<T> coder, String encodingId) throws Exception
Exceptionpublic static <T> void coderAllowsEncoding(Coder<T> coder, String encodingId) throws Exception
Exceptionpublic static <T> void structuralValueConsistentWithEquals(Coder<T> coder, T value1, T value2) throws Exception
Exceptionpublic static <T> void structuralValueConsistentWithEqualsInContext(Coder<T> coder, Coder.Context context, T value1, T value2) throws Exception
Exceptionpublic static <T> void coderDecodesBase64(Coder<T> coder, String base64Encoding, T value) throws Exception
Exceptionpublic static <T> void coderDecodesBase64(Coder<T> coder, List<String> base64Encodings, List<T> values) throws Exception
Exceptionpublic static <T> void coderEncodesBase64(Coder<T> coder, T value, String base64Encoding) throws Exception
Exceptionpublic static <T> void coderEncodesBase64(Coder<T> coder, List<T> values, List<String> base64Encodings) throws Exception
Exceptionpublic static <T,IterableT extends Iterable<T>> void coderDecodesBase64ContentsEqual(Coder<IterableT> coder, String base64Encoding, IterableT expected) throws Exception
Exception