Search in sources :

Example 16 with IntStream

use of java.util.stream.IntStream in project kie-wb-common by kiegroup.

the class AbstractFormDefinitionGeneratorTest method verifyUserForm.

protected void verifyUserForm(FormMigrationSummary summary) {
    Form originalForm = summary.getOriginalForm().get();
    Assertions.assertThat(originalForm.getFormFields()).isNotEmpty().hasSize(2);
    FormDefinition newForm = summary.getNewForm().get();
    Assertions.assertThat(newForm.getFields()).isNotEmpty().hasSize(2);
    Assertions.assertThat(newForm.getModel()).isNotNull().hasFieldOrPropertyWithValue("className", USER_MODEL).isInstanceOf(DataObjectFormModel.class);
    IntStream indexStream = IntStream.range(0, newForm.getFields().size());
    LayoutTemplate formLayout = newForm.getLayoutTemplate();
    assertNotNull(formLayout);
    Assertions.assertThat(formLayout.getRows()).isNotEmpty().hasSize(2);
    indexStream.forEach(index -> {
        FieldDefinition fieldDefinition = newForm.getFields().get(index);
        switch(index) {
            case 0:
                checkFieldDefinition(fieldDefinition, USER_LOGIN, "login", "login", TextBoxFieldDefinition.class, newForm, originalForm.getField(fieldDefinition.getName()));
                break;
            case 1:
                checkFieldDefinition(fieldDefinition, USER_PASSWORD, "password", "password", TextBoxFieldDefinition.class, newForm, originalForm.getField(fieldDefinition.getName()));
                break;
        }
        LayoutRow fieldRow = formLayout.getRows().get(index);
        assertNotNull(fieldRow);
        Assertions.assertThat(fieldRow.getLayoutColumns()).isNotEmpty().hasSize(1);
        LayoutColumn fieldColumn = fieldRow.getLayoutColumns().get(0);
        assertNotNull(fieldColumn);
        assertEquals("12", fieldColumn.getSpan());
        Assertions.assertThat(fieldColumn.getLayoutComponents()).isNotEmpty().hasSize(1);
        checkLayoutFormField(fieldColumn.getLayoutComponents().get(0), fieldDefinition, newForm);
    });
}
Also used : LayoutTemplate(org.uberfire.ext.layout.editor.api.editor.LayoutTemplate) Form(org.kie.workbench.common.forms.migration.legacy.model.Form) LayoutRow(org.uberfire.ext.layout.editor.api.editor.LayoutRow) FieldDefinition(org.kie.workbench.common.forms.model.FieldDefinition) DecimalBoxFieldDefinition(org.kie.workbench.common.forms.fields.shared.fieldTypes.basic.decimalBox.definition.DecimalBoxFieldDefinition) IntegerBoxFieldDefinition(org.kie.workbench.common.forms.fields.shared.fieldTypes.basic.integerBox.definition.IntegerBoxFieldDefinition) SubFormFieldDefinition(org.kie.workbench.common.forms.fields.shared.fieldTypes.relations.subForm.definition.SubFormFieldDefinition) TextBoxFieldDefinition(org.kie.workbench.common.forms.fields.shared.fieldTypes.basic.textBox.definition.TextBoxFieldDefinition) MultipleSubFormFieldDefinition(org.kie.workbench.common.forms.fields.shared.fieldTypes.relations.multipleSubform.definition.MultipleSubFormFieldDefinition) LayoutColumn(org.uberfire.ext.layout.editor.api.editor.LayoutColumn) FormDefinition(org.kie.workbench.common.forms.model.FormDefinition) IntStream(java.util.stream.IntStream)

Example 17 with IntStream

use of java.util.stream.IntStream in project assertj-core by joel-costigliola.

the class Assertions_assertThat_with_IntStream_Test method isInstanceOfAny_should_check_the_original_stream_without_consuming_it.

@Test
public void isInstanceOfAny_should_check_the_original_stream_without_consuming_it() {
    IntStream stream = mock(IntStream.class);
    assertThat(stream).isInstanceOfAny(IntStream.class, String.class);
    verifyZeroInteractions(stream);
}
Also used : IntStream(java.util.stream.IntStream) Test(org.junit.Test)

Example 18 with IntStream

use of java.util.stream.IntStream in project assertj-core by joel-costigliola.

the class Assertions_assertThat_with_IntStream_Test method isInstanceOf_should_check_the_original_stream_without_consuming_it.

@Test
public void isInstanceOf_should_check_the_original_stream_without_consuming_it() {
    IntStream stream = mock(IntStream.class);
    assertThat(stream).isInstanceOf(IntStream.class);
    verifyZeroInteractions(stream);
}
Also used : IntStream(java.util.stream.IntStream) Test(org.junit.Test)

Example 19 with IntStream

use of java.util.stream.IntStream in project assertj-core by joel-costigliola.

the class Assertions_assertThat_with_IntStream_Test method should_not_consume_stream_when_asserting_non_null.

@Test
public void should_not_consume_stream_when_asserting_non_null() {
    IntStream stream = mock(IntStream.class);
    assertThat(stream).isNotNull();
    verifyZeroInteractions(stream);
}
Also used : IntStream(java.util.stream.IntStream) Test(org.junit.Test)

Example 20 with IntStream

use of java.util.stream.IntStream in project assertj-core by joel-costigliola.

the class Assertions_assertThat_with_IntStream_Test method isSameAs_should_check_the_original_stream_without_consuming_it.

@Test
public void isSameAs_should_check_the_original_stream_without_consuming_it() {
    IntStream stream = mock(IntStream.class);
    assertThat(stream).isSameAs(stream);
    verifyZeroInteractions(stream);
}
Also used : IntStream(java.util.stream.IntStream) Test(org.junit.Test)

Aggregations

IntStream (java.util.stream.IntStream)80 Test (org.junit.Test)20 List (java.util.List)15 ArrayList (java.util.ArrayList)13 Arrays (java.util.Arrays)10 Stream (java.util.stream.Stream)9 Random (java.util.Random)7 Collectors (java.util.stream.Collectors)7 Map (java.util.Map)5 Pattern (java.util.regex.Pattern)5 DoubleStream (java.util.stream.DoubleStream)5 LongStream (java.util.stream.LongStream)5 DecimalBoxFieldDefinition (org.kie.workbench.common.forms.fields.shared.fieldTypes.basic.decimalBox.definition.DecimalBoxFieldDefinition)5 MultipleSubFormFieldDefinition (org.kie.workbench.common.forms.fields.shared.fieldTypes.relations.multipleSubform.definition.MultipleSubFormFieldDefinition)5 SubFormFieldDefinition (org.kie.workbench.common.forms.fields.shared.fieldTypes.relations.subForm.definition.SubFormFieldDefinition)5 FieldDefinition (org.kie.workbench.common.forms.model.FieldDefinition)5 LayoutRow (org.uberfire.ext.layout.editor.api.editor.LayoutRow)5 LayoutTemplate (org.uberfire.ext.layout.editor.api.editor.LayoutTemplate)5 Assert (org.junit.Assert)4 Test (org.junit.jupiter.api.Test)4