use of com.datastax.oss.driver.shaded.guava.common.collect.SetMultimap in project dsbulk by datastax.
the class SchemaSettingsTest method assertMapping.
private static void assertMapping(DefaultMapping mapping, Object... fieldsAndVars) {
ImmutableSetMultimap.Builder<Object, Object> expected = ImmutableSetMultimap.builder();
for (int i = 0; i < fieldsAndVars.length; i += 2) {
String first = fieldsAndVars[i] instanceof String ? (String) fieldsAndVars[i] : ((CqlIdentifier) fieldsAndVars[i]).asInternal();
CQLWord second = fieldsAndVars[i + 1] instanceof String ? CQLWord.fromInternal((String) fieldsAndVars[i + 1]) : CQLWord.fromCqlIdentifier((CqlIdentifier) fieldsAndVars[i + 1]);
if (CharMatcher.inRange('0', '9').matchesAllOf(first)) {
expected.put(new DefaultIndexedField(Integer.parseInt(first)), second);
} else {
expected.put(new DefaultMappedField(first), second);
}
}
@SuppressWarnings("unchecked") SetMultimap<Field, CQLWord> fieldsToVariables = (SetMultimap<Field, CQLWord>) getInternalState(mapping, "fieldsToVariables");
assertThat(fieldsToVariables).isEqualTo(expected.build());
}
Aggregations