Search in sources :

Example 1 with GeneratedFileType

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();
}
Also used : GeneratedFileType(org.drools.codegen.common.GeneratedFileType) Test(org.junit.jupiter.api.Test)

Example 2 with GeneratedFileType

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();
}
Also used : GeneratedFileType(org.drools.codegen.common.GeneratedFileType) Test(org.junit.jupiter.api.Test)

Example 3 with GeneratedFileType

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();
}
Also used : GeneratedFileType(org.drools.codegen.common.GeneratedFileType) Test(org.junit.jupiter.api.Test)

Example 4 with GeneratedFileType

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);
}
Also used : GeneratedFileType(org.drools.codegen.common.GeneratedFileType) Test(org.junit.jupiter.api.Test)

Example 5 with GeneratedFileType

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();
}
Also used : GeneratedFileType(org.drools.codegen.common.GeneratedFileType) Test(org.junit.jupiter.api.Test)

Aggregations

GeneratedFileType (org.drools.codegen.common.GeneratedFileType)5 Test (org.junit.jupiter.api.Test)5