Elffuss BraidHub

kikocis/java-driver public

Add tests for case-sensitivity in the mapper.
Changeset356657f61364859066a496cb268d4a437ee02662bcd6867322e922bdbd8c4977
AuthorAlexandre Dutra <alexandre.dutra@datastax.com> · 2016-06-01 16:23 +02:00
Committerolim7t <omichallat+github@gmail.com> · 2016-07-22 09:47 -07:00
Parentsdd37f80f3022

Browse the files at this changeset

11 files changed

modified driver-mapping/src/main/java/com/datastax/driver/mapping/AnnotationParser.java +17 −18
@@ -16,6 +16,7 @@
1616 package com.datastax.driver.mapping;
1717
1818 import com.datastax.driver.core.ConsistencyLevel;
19+import com.datastax.driver.core.Metadata;
1920 import com.datastax.driver.core.TableMetadata;
2021 import com.datastax.driver.core.TypeCodec;
2122 import com.datastax.driver.core.UserType;
@@ -34,8 +35,6 @@
3435 import java.util.*;
3536 import java.util.concurrent.atomic.AtomicInteger;
3637
37-import static com.datastax.driver.core.Metadata.quote;
38-
3938 /**
4039 * Static methods that facilitates parsing:
4140 * - {@link #parseEntity(Class, MappingManager)}: entity classes into {@link EntityMapper} instances
@@ -48,13 +47,13 @@
4847 @VisibleForTesting
4948 static final Set<Class<? extends Annotation>> VALID_PROPERTY_ANNOTATIONS = ImmutableSet.of(
5049 Column.class,
50+ Computed.class,
5151 ClusteringColumn.class,
5252 Frozen.class,
5353 FrozenKey.class,
5454 FrozenValue.class,
5555 PartitionKey.class,
56- Transient.class,
57- Computed.class);
56+ Transient.class);
5857
5958 @VisibleForTesting
6059 static final Set<Class<? extends Annotation>> VALID_FIELD_ANNOTATIONS = ImmutableSet.of(
@@ -77,20 +76,20 @@
7776 static <T> EntityMapper<T> parseEntity(final Class<T> entityClass, MappingManager mappingManager) {
7877 Table table = AnnotationChecks.getTypeAnnotation(Table.class, entityClass);
7978
80- String ksName = table.caseSensitiveKeyspace() ? table.keyspace() : table.keyspace().toLowerCase();
81- String tableName = table.caseSensitiveTable() ? table.name() : table.name().toLowerCase();
79+ String ksName = table.caseSensitiveKeyspace() ? Metadata.quote(table.keyspace()) : table.keyspace().toLowerCase();
80+ String tableName = table.caseSensitiveTable() ? Metadata.quote(table.name()) : table.name().toLowerCase();
8281
8382 ConsistencyLevel writeConsistency = table.writeConsistency().isEmpty() ? null : ConsistencyLevel.valueOf(table.writeConsistency().toUpperCase());
8483 ConsistencyLevel readConsistency = table.readConsistency().isEmpty() ? null : ConsistencyLevel.valueOf(table.readConsistency().toUpperCase());
8584
8685 if (Strings.isNullOrEmpty(table.keyspace())) {
87- ksName = mappingManager.getSession().getLoggedKeyspace();
88- if (Strings.isNullOrEmpty(ksName))
86+ String loggedKeyspace = mappingManager.getSession().getLoggedKeyspace();
87+ if (Strings.isNullOrEmpty(loggedKeyspace))
8988 throw new IllegalArgumentException(String.format(
90- "Error creating mapper for class %s, the @%s annotation declares no default keyspace, and the session is not currently logged to any keyspace",
91- entityClass.getSimpleName(),
92- Table.class.getSimpleName()
89+ "Error creating mapper for %s, the @Table annotation declares no default keyspace, and the session is not currently logged to any keyspace",
90+ entityClass
9391 ));
92+ ksName = Metadata.quote(loggedKeyspace);
9493 }
9594
9695 EntityMapper<T> mapper = new EntityMapper<T>(entityClass, ksName, tableName, writeConsistency, readConsistency);
@@ -154,17 +153,17 @@
154153 static <T> MappedUDTCodec<T> parseUDT(Class<T> udtClass, MappingManager mappingManager) {
155154 UDT udt = AnnotationChecks.getTypeAnnotation(UDT.class, udtClass);
156155
157- String ksName = udt.caseSensitiveKeyspace() ? udt.keyspace() : udt.keyspace().toLowerCase();
158- String udtName = udt.caseSensitiveType() ? quote(udt.name()) : udt.name().toLowerCase();
156+ String ksName = udt.caseSensitiveKeyspace() ? Metadata.quote(udt.keyspace()) : udt.keyspace().toLowerCase();
157+ String udtName = udt.caseSensitiveType() ? Metadata.quote(udt.name()) : udt.name().toLowerCase();
159158
160159 if (Strings.isNullOrEmpty(udt.keyspace())) {
161- ksName = mappingManager.getSession().getLoggedKeyspace();
162- if (Strings.isNullOrEmpty(ksName))
160+ String loggedKeyspace = mappingManager.getSession().getLoggedKeyspace();
161+ if (Strings.isNullOrEmpty(loggedKeyspace))
163162 throw new IllegalArgumentException(String.format(
164- "Error creating UDT codec for class %s, the @%s annotation declares no default keyspace, and the session is not currently logged to any keyspace",
165- udtClass.getSimpleName(),
166- UDT.class.getSimpleName()
163+ "Error creating UDT codec for %s, the @UDT annotation declares no default keyspace, and the session is not currently logged to any keyspace",
164+ udtClass
167165 ));
166+ ksName = Metadata.quote(loggedKeyspace);
168167 }
169168
170169 UserType userType = mappingManager.getSession().getCluster().getMetadata().getKeyspace(ksName).getUserType(udtName);
modified driver-mapping/src/main/java/com/datastax/driver/mapping/EntityMapper.java +2 −12
@@ -20,13 +20,11 @@
2020 import java.util.ArrayList;
2121 import java.util.List;
2222
23-import static com.datastax.driver.core.querybuilder.QueryBuilder.quote;
24-
2523 class EntityMapper<T> {
2624
2725 private final Class<T> entityClass;
28- private final String keyspace;
29- private final String table;
26+ final String keyspace;
27+ final String table;
3028
3129 final ConsistencyLevel writeConsistency;
3230 final ConsistencyLevel readConsistency;
@@ -44,14 +42,6 @@
4442 this.readConsistency = readConsistency;
4543 }
4644
47- String getKeyspace() {
48- return quote(keyspace);
49- }
50-
51- String getTable() {
52- return quote(table);
53- }
54-
5545 int primaryKeySize() {
5646 return partitionKeys.size() + clusteringColumns.size();
5747 }
modified driver-mapping/src/main/java/com/datastax/driver/mapping/MappedUDTCodec.java +4 −8
@@ -15,7 +15,10 @@
1515 */
1616 package com.datastax.driver.mapping;
1717
18-import com.datastax.driver.core.*;
18+import com.datastax.driver.core.CodecRegistry;
19+import com.datastax.driver.core.ProtocolVersion;
20+import com.datastax.driver.core.TypeCodec;
21+import com.datastax.driver.core.UserType;
1922
2023 import java.nio.ByteBuffer;
2124 import java.util.Map;
@@ -48,10 +51,6 @@
4851
4952 @Override
5053 protected ByteBuffer serializeField(T source, String fieldName, ProtocolVersion protocolVersion) {
51- // The parent class passes lowercase names unquoted, but in our internal map of mappers they are always quoted
52- if (!fieldName.startsWith("\""))
53- fieldName = Metadata.quote(fieldName);
54-
5554 PropertyMapper propertyMapper = columnMappers.get(fieldName);
5655
5756 if (propertyMapper == null)
@@ -68,9 +67,6 @@
6867
6968 @Override
7069 protected T deserializeAndSetField(ByteBuffer input, T target, String fieldName, ProtocolVersion protocolVersion) {
71- if (!fieldName.startsWith("\""))
72- fieldName = Metadata.quote(fieldName);
73-
7470 PropertyMapper propertyMapper = columnMappers.get(fieldName);
7571 if (propertyMapper != null) {
7672 TypeCodec<Object> codec = propertyMapper.customCodec;
modified driver-mapping/src/main/java/com/datastax/driver/mapping/Mapper.java +2 −2
@@ -72,8 +72,8 @@
7272 this.klass = klass;
7373 this.mapper = mapper;
7474
75- KeyspaceMetadata keyspace = session().getCluster().getMetadata().getKeyspace(mapper.getKeyspace());
76- this.tableMetadata = keyspace == null ? null : keyspace.getTable(mapper.getTable());
75+ KeyspaceMetadata keyspace = session().getCluster().getMetadata().getKeyspace(mapper.keyspace);
76+ this.tableMetadata = keyspace == null ? null : keyspace.getTable(mapper.table);
7777
7878 this.mapOneFunction = new Function<ResultSet, T>() {
7979 @Override
modified driver-mapping/src/main/java/com/datastax/driver/mapping/PropertyMapper.java +14 −9
@@ -130,18 +130,23 @@
130130 }
131131
132132 private String inferColumnName() {
133- Column column = annotation(Column.class);
134- if (column != null && !column.name().isEmpty()) {
135- return Metadata.quote(column.caseSensitive() ? column.name() : column.name().toLowerCase());
136- }
137- com.datastax.driver.mapping.annotations.Field udtField = annotation(com.datastax.driver.mapping.annotations.Field.class);
138- if (udtField != null && !udtField.name().isEmpty()) {
139- return Metadata.quote(udtField.caseSensitive() ? udtField.name() : udtField.name().toLowerCase());
140- }
141133 if (isComputed()) {
142134 return annotation(Computed.class).value();
143135 }
144- return Metadata.quote(propertyName.toLowerCase());
136+ boolean caseSensitive = false;
137+ String columnName = propertyName;
138+ if (hasAnnotation(Column.class)) {
139+ Column column = annotation(Column.class);
140+ caseSensitive = column.caseSensitive();
141+ if (!column.name().isEmpty())
142+ columnName = column.name();
143+ } else if (hasAnnotation(com.datastax.driver.mapping.annotations.Field.class)) {
144+ com.datastax.driver.mapping.annotations.Field udtField = annotation(com.datastax.driver.mapping.annotations.Field.class);
145+ caseSensitive = udtField.caseSensitive();
146+ if (!udtField.name().isEmpty())
147+ columnName = udtField.name();
148+ }
149+ return caseSensitive ? Metadata.quote(columnName) : columnName.toLowerCase();
145150 }
146151
147152 @SuppressWarnings("unchecked")
modified driver-mapping/src/main/java/com/datastax/driver/mapping/QueryType.java +3 −3
@@ -31,7 +31,7 @@
3131 @Override
3232 String makePreparedQueryString(TableMetadata table, EntityMapper<?> mapper, MappingManager manager, Set<PropertyMapper> columns, Collection<Mapper.Option> options) {
3333 Insert insert = table == null
34- ? insertInto(mapper.getKeyspace(), mapper.getTable())
34+ ? insertInto(mapper.keyspace, mapper.table)
3535 : insertInto(table);
3636 for (PropertyMapper col : columns)
3737 if (!col.isComputed())
@@ -65,7 +65,7 @@
6565 }
6666 Select select;
6767 if (table == null) {
68- select = selection.from(mapper.getKeyspace(), mapper.getTable());
68+ select = selection.from(mapper.keyspace, mapper.table);
6969 } else {
7070 select = selection.from(table);
7171 }
@@ -83,7 +83,7 @@
8383 @Override
8484 String makePreparedQueryString(TableMetadata table, EntityMapper<?> mapper, MappingManager manager, Set<PropertyMapper> columns, Collection<Mapper.Option> options) {
8585 Delete delete = table == null
86- ? delete().all().from(mapper.getKeyspace(), mapper.getTable())
86+ ? delete().all().from(mapper.keyspace, mapper.table)
8787 : delete().all().from(table);
8888 Delete.Where where = delete.where();
8989 for (int i = 0; i < mapper.primaryKeySize(); i++)
added driver-mapping/src/test/java/com/datastax/driver/mapping/MapperCaseSensitivenessTest.java +180 −0
@@ -0,0 +1,180 @@
1+/*
2+ * Copyright (C) 2012-2015 DataStax Inc.
3+ *
4+ * Licensed under the Apache License, Version 2.0 (the "License");
5+ * you may not use this file except in compliance with the License.
6+ * You may obtain a copy of the License at
7+ *
8+ * http://www.apache.org/licenses/LICENSE-2.0
9+ *
10+ * Unless required by applicable law or agreed to in writing, software
11+ * distributed under the License is distributed on an "AS IS" BASIS,
12+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+ * See the License for the specific language governing permissions and
14+ * limitations under the License.
15+ */
16+package com.datastax.driver.mapping;
17+
18+import com.datastax.driver.core.CCMConfig;
19+import com.datastax.driver.core.CCMTestsSupport;
20+import com.datastax.driver.core.TestUtils;
21+import com.datastax.driver.mapping.annotations.*;
22+import com.google.common.base.Objects;
23+import org.testng.annotations.Test;
24+
25+import static com.datastax.driver.core.Metadata.quote;
26+import static org.assertj.core.api.Assertions.assertThat;
27+
28+/**
29+ *
30+ */
31+@CCMConfig(createKeyspace = false)
32+@SuppressWarnings({"unused", "WeakerAccess"})
33+public class MapperCaseSensitivenessTest extends CCMTestsSupport {
34+
35+ static final String KS = "ks_MapperCaseSensitivenessTest";
36+ static final String TABLE = "table_MapperCaseSensitivenessTest";
37+ static final String TYPE = "udt_MapperCaseSensitivenessTest";
38+
39+ UserNoKeyspace user = new UserNoKeyspace("id", new Address("street", "zip"));
40+
41+ @Table(keyspace = KS, name = TABLE, caseSensitiveKeyspace = true, caseSensitiveTable = true)
42+ static class User {
43+
44+ @PartitionKey
45+ @Column(caseSensitive = true)
46+ private String userId;
47+
48+ @Column(name = "Address", caseSensitive = true)
49+ private Address address;
50+
51+ public User() {
52+ }
53+
54+ public User(String userId, Address address) {
55+ this.userId = userId;
56+ this.address = address;
57+ }
58+
59+ public String getUserId() {
60+ return userId;
61+ }
62+
63+ public void setUserId(String userId) {
64+ this.userId = userId;
65+ }
66+
67+ public Address getAddress() {
68+ return address;
69+ }
70+
71+ public void setAddress(Address address) {
72+ this.address = address;
73+ }
74+
75+ @Override
76+ public boolean equals(Object o) {
77+ if (this == o) return true;
78+ if (o == null || !(o instanceof User)) return false;
79+ User user = (User) o;
80+ return Objects.equal(userId, user.userId) &&
81+ Objects.equal(address, user.address);
82+ }
83+
84+ @Override
85+ public int hashCode() {
86+ return Objects.hashCode(userId, address);
87+ }
88+ }
89+
90+ @UDT(keyspace = KS, name = TYPE, caseSensitiveKeyspace = true, caseSensitiveType = true)
91+ static class Address {
92+
93+ @Field(name = "Street", caseSensitive = true)
94+ private String street;
95+
96+ @Field(caseSensitive = true)
97+ private String zipCode;
98+
99+ public Address() {
100+ }
101+
102+ public Address(String street, String zipCode) {
103+ this.street = street;
104+ this.zipCode = zipCode;
105+ }
106+
107+ public String getStreet() {
108+ return street;
109+ }
110+
111+ public void setStreet(String street) {
112+ this.street = street;
113+ }
114+
115+ public String getZipCode() {
116+ return zipCode;
117+ }
118+
119+ public void setZipCode(String zipCode) {
120+ this.zipCode = zipCode;
121+ }
122+
123+ @Override
124+ public boolean equals(Object o) {
125+ if (this == o) return true;
126+ if (o == null || !(o instanceof Address)) return false;
127+ Address address = (Address) o;
128+ return Objects.equal(street, address.street) &&
129+ Objects.equal(zipCode, address.zipCode);
130+ }
131+
132+ @Override
133+ public int hashCode() {
134+ return Objects.hashCode(getStreet(), getZipCode());
135+ }
136+ }
137+
138+ @Table(name = TABLE, caseSensitiveKeyspace = true, caseSensitiveTable = true)
139+ static class UserNoKeyspace extends User {
140+
141+ public UserNoKeyspace() {
142+ }
143+
144+ public UserNoKeyspace(String id, Address address) {
145+ super(id, address);
146+ }
147+
148+ }
149+
150+ @UDT(name = TYPE, caseSensitiveKeyspace = true, caseSensitiveType = true)
151+ static class AddressNoKeyspace extends Address {
152+
153+ }
154+
155+ @Override
156+ public void onTestContextInitialized() {
157+ execute(String.format(TestUtils.CREATE_KEYSPACE_SIMPLE_FORMAT, quote(KS), 1));
158+ useKeyspace(quote(KS));
159+ execute(
160+ "CREATE TYPE " + quote(TYPE) + " (\"Street\" text, \"zipCode\" text)",
161+ "CREATE TABLE " + quote(TABLE) + " (\"userId\" text PRIMARY KEY, \"Address\" frozen<" + quote(TYPE) + ">)");
162+ }
163+
164+ @Test(groups = "short")
165+ public void should_handle_case_sensitive_identifiers_when_keyspace_specified() throws Exception {
166+ MappingManager mappingManager = new MappingManager(session());
167+ Mapper<User> mapper = mappingManager.mapper(User.class);
168+ mapper.save(user);
169+ assertThat(mapper.get(user.getUserId())).isEqualTo(user);
170+ }
171+
172+ @Test(groups = "short")
173+ public void should_handle_case_sensitive_identifiers_whitout_keyspace_specified() throws Exception {
174+ MappingManager mappingManager = new MappingManager(session());
175+ Mapper<UserNoKeyspace> mapper = mappingManager.mapper(UserNoKeyspace.class);
176+ mapper.save(user);
177+ assertThat(mapper.get(user.getUserId())).isEqualTo(user);
178+ }
179+
180+}
modified driver-mapping/src/test/java/com/datastax/driver/mapping/MapperComputedFieldsTest.java +1 −1
@@ -91,7 +91,7 @@
9191 void should_add_aliases_for_fields_in_select_queries() {
9292 BoundStatement bs = (BoundStatement) userMapper.getQuery("test");
9393 assertThat(bs.preparedStatement().getQueryString())
94- .contains("SELECT", "\"login\" AS col", "\"name\" AS col", "writetime(\"name\") AS col");
94+ .contains("SELECT", "login AS col", "name AS col", "writetime(\"name\") AS col");
9595 }
9696
9797 @Test(groups = "short")
modified driver-mapping/src/test/java/com/datastax/driver/mapping/MapperDefaultKeyspaceTest.java +2 −2
@@ -92,7 +92,7 @@
9292
9393 @Test(groups = "short",
9494 expectedExceptions = IllegalArgumentException.class,
95- expectedExceptionsMessageRegExp = "Error creating mapper for class Group, the @Table annotation declares no default keyspace, and the session is not currently logged to any keyspace")
95+ expectedExceptionsMessageRegExp = "Error creating mapper for class com.datastax.driver.mapping.MapperDefaultKeyspaceTest\\$Group, the @Table annotation declares no default keyspace, and the session is not currently logged to any keyspace")
9696 public void should_throw_a_meaningful_error_message_when_no_default_table_keyspace_and_session_not_logged() {
9797 Session session2 = cluster().connect();
9898 MappingManager manager = new MappingManager(session2);
@@ -101,7 +101,7 @@
101101
102102 @Test(groups = "short",
103103 expectedExceptions = IllegalArgumentException.class,
104- expectedExceptionsMessageRegExp = "Error creating UDT codec for class GroupName, the @UDT annotation declares no default keyspace, and the session is not currently logged to any keyspace")
104+ expectedExceptionsMessageRegExp = "Error creating UDT codec for class com.datastax.driver.mapping.MapperDefaultKeyspaceTest\\$GroupName, the @UDT annotation declares no default keyspace, and the session is not currently logged to any keyspace")
105105 public void should_throw_a_meaningful_error_message_when_no_default_udt_keyspace_and_session_not_logged() {
106106 Session session2 = cluster().connect();
107107 MappingManager manager = new MappingManager(session2);
modified driver-mapping/src/test/java/com/datastax/driver/mapping/MapperSaveNullFieldsTest.java +4 −4
@@ -83,14 +83,14 @@
8383 BoundStatement bs = (BoundStatement) mapper.saveQuery(newUser, options);
8484 String queryString = bs.preparedStatement().getQueryString();
8585 if (nullName && !saveExpected)
86- assertThat(queryString).as(description).doesNotContain("\"name\"");
86+ assertThat(queryString).as(description).doesNotContain("name");
8787 else
88- assertThat(queryString).as(description).contains("\"name\"");
88+ assertThat(queryString).as(description).contains("name");
8989
9090 if (nullPhone && !saveExpected)
91- assertThat(queryString).as(description).doesNotContain("\"phone\"");
91+ assertThat(queryString).as(description).doesNotContain("phone");
9292 else
93- assertThat(queryString).as(description).contains("\"phone\"");
93+ assertThat(queryString).as(description).contains("phone");
9494
9595 // Save entity and check the data
9696 mapper.save(newUser, options);
modified driver-mapping/src/test/java/com/datastax/driver/mapping/MapperUDTTest.java +10 −10
@@ -380,7 +380,7 @@
380380 /**
381381 * Ensures that if a table is altered after a {@link Mapper} is created that it continues to work as long as
382382 * the change is compatible. A new column is added to the table in this case, which is a compatible change.
383- * <p>
383+ * <p/>
384384 * It also ensures that after the change is made that requesting a new {@link Mapper} returns a different instance
385385 * instead of the existing one.
386386 *
@@ -407,7 +407,7 @@
407407 /**
408408 * Ensures that if a UDT is altered after a {@link Mapper} is created that has a UDT that it continues to work as
409409 * long as the change is compatible. A new field is added to the table in this case, which is a compatible change.
410- * <p>
410+ * <p/>
411411 * It also ensures that after the change is made that requesting a new {@link TypeCodec} for that UDT and a new
412412 * {@link Mapper} for a table using that UDT returns different instances instead of the existing ones.
413413 *
@@ -440,7 +440,7 @@
440440 * Ensures that if a table is dropped after a {@link Mapper} is created that the {@link Mapper} can no longer
441441 * successfully make queries and that attempting to create a new {@link Mapper} throws an
442442 * {@link IllegalArgumentException}.
443- * <p>
443+ * <p/>
444444 * It also ensures that requesting a {@link Mapper} fails as the previous {@link Mapper} was evicted and a new
445445 * one cannot be created as the table has been dropped.
446446 *
@@ -471,14 +471,14 @@
471471 manager.mapper(User.class);
472472 fail("Expected IllegalArgumentException");
473473 } catch (IllegalArgumentException e) {
474- assertThat(e.getMessage()).isEqualTo("Table users does not exist in keyspace " + keyspace);
474+ assertThat(e.getMessage()).isEqualTo("Table users does not exist in keyspace \"" + keyspace + "\"");
475475 }
476476 }
477477
478478 /**
479479 * Ensures that if a table is altered after a {@link Mapper} is created that it no longer continues to work if
480480 * the change is not compatible. A column is dropped from the table in this case, which is an incompatible change.
481- * <p>
481+ * <p/>
482482 * It also ensures that requesting a {@link Mapper} fails as the previous {@link Mapper} was evicted and a new
483483 * one cannot be created as a declared column is missing from the schema but is present in the class definition.
484484 *
@@ -509,7 +509,7 @@
509509 manager.mapper(User.class);
510510 fail("Expected IllegalArgumentException");
511511 } catch (IllegalArgumentException e) {
512- assertThat(e.getMessage()).isEqualTo(String.format("Column \"mainaddress\" does not exist in table %s.users", keyspace));
512+ assertThat(e.getMessage()).isEqualTo(String.format("Column mainaddress does not exist in table \"%s\".users", keyspace));
513513 }
514514 }
515515
@@ -517,10 +517,10 @@
517517 * Ensures that if a UDT is altered after a {@link Mapper} is created that it no longer continues to work if
518518 * the change made to the UDT is not compatible. A field is renamed in the UDT in this case, which is not a
519519 * compatible change.
520- * <p>
520+ * <p/>
521521 * It also ensures that requesting a {@link Mapper} fails as the previous {@link Mapper} was evicted and a new
522522 * one cannot be created as a declared field is missing from the schema but is present in the class definition.
523- * <p>
523+ * <p/>
524524 * Also verifies that a {@link TypeCodec} cannot be requested for the UDT as well.
525525 *
526526 * @jira_ticket JAVA-1126
@@ -552,13 +552,13 @@
552552 manager.mapper(User.class);
553553 fail("Expected IllegalArgumentException");
554554 } catch (IllegalArgumentException e) {
555- assertThat(e.getMessage()).isEqualTo(String.format("Field \"ZIP_code\" does not exist in type %s.address", keyspace));
555+ assertThat(e.getMessage()).isEqualTo(String.format("Field \"ZIP_code\" does not exist in type \"%s\".address", keyspace));
556556 }
557557 try {
558558 manager.udtCodec(Address.class);
559559 fail("Expected IllegalArgumentException");
560560 } catch (IllegalArgumentException e) {
561- assertThat(e.getMessage()).isEqualTo(String.format("Field \"ZIP_code\" does not exist in type %s.address", keyspace));
561+ assertThat(e.getMessage()).isEqualTo(String.format("Field \"ZIP_code\" does not exist in type \"%s\".address", keyspace));
562562 }
563563 }
564564