|
21 | 21 | import java.util.Collection;
|
22 | 22 | import java.util.Map;
|
23 | 23 |
|
24 |
| -import org.assertj.core.api.Assertions; |
25 | 24 | import org.junit.jupiter.api.BeforeEach;
|
26 | 25 | import org.junit.jupiter.api.Test;
|
27 | 26 | import org.springframework.data.annotation.Id;
|
@@ -66,24 +65,21 @@ private KeyspaceMetadata getKeyspaceMetadata() {
|
66 | 65 | return getSession().getKeyspace().flatMap(metadata::getKeyspace).get();
|
67 | 66 | }
|
68 | 67 |
|
69 |
| - @Test |
70 |
| - void givenAdminTemplate_whenCreateTableWithOptions_ThenCreatedTableContainsTheseOptions() { |
71 |
| - cassandraAdminTemplate.createTable( |
72 |
| - true, |
73 |
| - CqlIdentifier.fromCql("someTable"), |
74 |
| - SomeTable.class, |
75 |
| - Map.of( |
76 |
| - TableOption.COMMENT.getName(), "This is comment for table", |
77 |
| - TableOption.BLOOM_FILTER_FP_CHANCE.getName(), "0.3" |
78 |
| - ) |
79 |
| - ); |
80 |
| - |
81 |
| - TableMetadata someTable = getKeyspaceMetadata().getTables().values().stream().findFirst().orElse(null); |
82 |
| - |
83 |
| - Assertions.assertThat(someTable).isNotNull(); |
84 |
| - Assertions.assertThat(someTable.getOptions().get(CqlIdentifier.fromCql(TableOption.COMMENT.getName()))) |
| 68 | + @Test // GH-359 |
| 69 | + void shouldApplyTableOptions() { |
| 70 | + |
| 71 | + Map<String, Object> options = Map.of(TableOption.COMMENT.getName(), "This is comment for table", // |
| 72 | + TableOption.BLOOM_FILTER_FP_CHANCE.getName(), "0.3"); |
| 73 | + |
| 74 | + CqlIdentifier tableName = CqlIdentifier.fromCql("someTable"); |
| 75 | + cassandraAdminTemplate.createTable(true, tableName, SomeTable.class, options); |
| 76 | + |
| 77 | + TableMetadata someTable = getKeyspaceMetadata().getTables().get(tableName); |
| 78 | + |
| 79 | + assertThat(someTable).isNotNull(); |
| 80 | + assertThat(someTable.getOptions().get(CqlIdentifier.fromCql(TableOption.COMMENT.getName()))) |
85 | 81 | .isEqualTo("This is comment for table");
|
86 |
| - Assertions.assertThat(someTable.getOptions().get(CqlIdentifier.fromCql(TableOption.BLOOM_FILTER_FP_CHANCE.getName()))) |
| 82 | + assertThat(someTable.getOptions().get(CqlIdentifier.fromCql(TableOption.BLOOM_FILTER_FP_CHANCE.getName()))) |
87 | 83 | .isEqualTo(0.3);
|
88 | 84 | }
|
89 | 85 |
|
@@ -117,8 +113,7 @@ void testDropTable() {
|
117 | 113 | @Table("someTable")
|
118 | 114 | private static class SomeTable {
|
119 | 115 |
|
120 |
| - @Id |
121 |
| - private String name; |
| 116 | + @Id private String name; |
122 | 117 | private Integer number;
|
123 | 118 | private LocalDate createdAt;
|
124 | 119 | }
|
|
0 commit comments