use of org.drools.codegen.common.GeneratedFileType in project kogito-runtimes by kiegroup.
the class GeneratedFileTypeTest method ofNameCategoryCanHotReload.
@Test
public void ofNameCategoryCanHotReload() {
assertThatThrownBy(() -> GeneratedFileType.of(null, Category.SOURCE, true)).isInstanceOf(NullPointerException.class);
String sourceName = Category.SOURCE.name();
assertThatThrownBy(() -> GeneratedFileType.of(sourceName, null, true)).isInstanceOf(NullPointerException.class);
GeneratedFileType sourceGeneratedType = GeneratedFileType.of("name", Category.SOURCE, false);
assertThat(sourceGeneratedType.category()).isEqualTo(Category.SOURCE);
assertThat(sourceGeneratedType.name()).isEqualTo("name");
assertThat(sourceGeneratedType.canHotReload()).isFalse();
assertThat(sourceGeneratedType.isCustomizable()).isFalse();
}
use of org.drools.codegen.common.GeneratedFileType in project kogito-runtimes by kiegroup.
the class GeneratedFileTypeTest method ofNameCategory.
@Test
public void ofNameCategory() {
assertThatThrownBy(() -> GeneratedFileType.of(null, Category.SOURCE)).isInstanceOf(NullPointerException.class);
String sourceName = Category.SOURCE.name();
assertThatThrownBy(() -> GeneratedFileType.of(sourceName, null)).isInstanceOf(NullPointerException.class);
GeneratedFileType sourceGeneratedType = GeneratedFileType.of("name", Category.SOURCE);
assertThat(sourceGeneratedType.category()).isEqualTo(Category.SOURCE);
assertThat(sourceGeneratedType.name()).isEqualTo("name");
assertThat(sourceGeneratedType.canHotReload()).isTrue();
assertThat(sourceGeneratedType.isCustomizable()).isFalse();
}
use of org.drools.codegen.common.GeneratedFileType in project kogito-runtimes by kiegroup.
the class GeneratedFileTypeTest method ofNameCategoryCanHotReloadCustomizable.
@Test
public void ofNameCategoryCanHotReloadCustomizable() {
assertThatThrownBy(() -> GeneratedFileType.of(null, Category.SOURCE, true, true)).isInstanceOf(NullPointerException.class);
String sourceName = Category.SOURCE.name();
assertThatThrownBy(() -> GeneratedFileType.of(sourceName, null, true, true)).isInstanceOf(NullPointerException.class);
GeneratedFileType sourceGeneratedType = GeneratedFileType.of("name", Category.SOURCE, false, true);
assertThat(sourceGeneratedType.category()).isEqualTo(Category.SOURCE);
assertThat(sourceGeneratedType.name()).isEqualTo("name");
assertThat(sourceGeneratedType.canHotReload()).isFalse();
assertThat(sourceGeneratedType.isCustomizable()).isTrue();
}
use of org.drools.codegen.common.GeneratedFileType in project kogito-runtimes by kiegroup.
the class GeneratedFileTypeTest method equalsOnValue.
@Test
public void equalsOnValue() {
GeneratedFileType mock = new MockGenericFileType();
GeneratedFileType sameType = GeneratedFileType.of(mock.name(), mock.category(), mock.canHotReload(), mock.isCustomizable());
GeneratedFileType differentType = GeneratedFileType.of(mock.name(), mock.category(), mock.canHotReload(), !mock.isCustomizable());
// GeneratedFileType equals should only consider values and not actual class
assertThat(sameType).isEqualTo(mock);
assertThat(differentType).isNotEqualTo(mock);
}
use of org.drools.codegen.common.GeneratedFileType in project kogito-runtimes by kiegroup.
the class GeneratedFileTypeTest method ofCategory.
@Test
public void ofCategory() {
assertThatThrownBy(() -> GeneratedFileType.of(null)).isInstanceOf(NullPointerException.class);
GeneratedFileType sourceGeneratedType = GeneratedFileType.of(Category.SOURCE);
assertThat(sourceGeneratedType.category()).isEqualTo(Category.SOURCE);
assertThat(sourceGeneratedType.name()).isEqualTo(Category.SOURCE.name());
assertThat(sourceGeneratedType.canHotReload()).isTrue();
assertThat(sourceGeneratedType.isCustomizable()).isFalse();
}
Aggregations