use of io.confluent.ksql.parser.DropType in project ksql by confluentinc.
the class DropTypeFactoryTest method shouldFailCreateTypeIfTypeDoesNotExist.
@Test
public void shouldFailCreateTypeIfTypeDoesNotExist() {
// Given:
final DropType dropType = new DropType(Optional.empty(), NOT_EXISTING_TYPE, false);
// When:
final Exception e = assertThrows(KsqlException.class, () -> factory.create(dropType));
// Then:
assertThat(e.getMessage(), equalTo("Type " + NOT_EXISTING_TYPE + " does not exist."));
}
use of io.confluent.ksql.parser.DropType in project ksql by confluentinc.
the class DropTypeFactoryTest method shouldCreateDropType.
@Test
public void shouldCreateDropType() {
// Given:
final DropType dropType = new DropType(Optional.empty(), EXISTING_TYPE, false);
// When:
final DropTypeCommand cmd = factory.create(dropType);
// Then:
assertThat(cmd.getTypeName(), equalTo(EXISTING_TYPE));
}
use of io.confluent.ksql.parser.DropType in project ksql by confluentinc.
the class DropTypeFactoryTest method shouldCreateDropTypeForExistingTypeAndIfExistsSet.
@Test
public void shouldCreateDropTypeForExistingTypeAndIfExistsSet() {
// Given:
final DropType dropType = new DropType(Optional.empty(), EXISTING_TYPE, true);
// When:
final DropTypeCommand cmd = factory.create(dropType);
// Then:
assertThat(cmd.getTypeName(), equalTo(EXISTING_TYPE));
}
use of io.confluent.ksql.parser.DropType in project ksql by confluentinc.
the class CommandFactoriesTest method shouldCreateDropType.
@Test
public void shouldCreateDropType() {
// Given:
final DropType dropType = new DropType(Optional.empty(), SOME_TYPE_NAME, false);
// When:
final DropTypeCommand cmd = (DropTypeCommand) commandFactories.create("sqlExpression", dropType, SessionConfig.of(ksqlConfig, emptyMap()));
// Then:
assertThat(cmd, is(dropTypeCommand));
verify(dropTypeFactory).create(dropType);
}
use of io.confluent.ksql.parser.DropType in project ksql by confluentinc.
the class DropTypeFactoryTest method shouldNotFailCreateTypeIfTypeDoesNotExistAndIfExistsSet.
@Test
public void shouldNotFailCreateTypeIfTypeDoesNotExistAndIfExistsSet() {
// Given:
final DropType dropType = new DropType(Optional.empty(), NOT_EXISTING_TYPE, true);
// When:
final DropTypeCommand cmd = factory.create(dropType);
// Then:
assertThat(cmd.getTypeName(), equalTo(NOT_EXISTING_TYPE));
}
Aggregations