Search in sources :

Example 16 with ReasonBuffer2

use of org.estatio.module.base.platform.applib.ReasonBuffer2 in project estatio by estatio.

the class ReasonBuffer2_Test method with_prefix_no_reasons.

@Test
public void with_prefix_no_reasons() throws Exception {
    final ReasonBuffer2 buf = ReasonBuffer2.forAll("Cannot change");
    buf.append(false, "reason #1");
    buf.append(false, "reason #2");
    Assertions.assertThat(buf.getReason()).isNull();
}
Also used : ReasonBuffer2(org.estatio.module.base.platform.applib.ReasonBuffer2) Test(org.junit.Test)

Example 17 with ReasonBuffer2

use of org.estatio.module.base.platform.applib.ReasonBuffer2 in project estatio by estatio.

the class ReasonBuffer2_Test method using_predicates.

@Test
public void using_predicates() throws Exception {
    final ReasonBuffer2 buf = ReasonBuffer2.forAll("Cannot change");
    buf.append(() -> false, "reason #1");
    buf.append(false, "reason #2");
    buf.append(true, "reason #3");
    buf.append(() -> true, "reason #4");
    Assertions.assertThat(buf.getReason()).isEqualTo("Cannot change: reason #3; reason #4");
}
Also used : ReasonBuffer2(org.estatio.module.base.platform.applib.ReasonBuffer2) Test(org.junit.Test)

Example 18 with ReasonBuffer2

use of org.estatio.module.base.platform.applib.ReasonBuffer2 in project estatio by estatio.

the class ReasonBuffer2_Test method with_prefix_single_reasons.

@Test
public void with_prefix_single_reasons() throws Exception {
    final ReasonBuffer2 buf = ReasonBuffer2.forAll("Cannot change");
    buf.append(true, "reason #1");
    buf.append(false, "reason #2");
    Assertions.assertThat(buf.getReason()).isEqualTo("Cannot change reason #1");
}
Also used : ReasonBuffer2(org.estatio.module.base.platform.applib.ReasonBuffer2) Test(org.junit.Test)

Example 19 with ReasonBuffer2

use of org.estatio.module.base.platform.applib.ReasonBuffer2 in project estatio by estatio.

the class ReasonBuffer2_Test method plus.

@Test
public void plus() throws Exception {
    final ReasonBuffer2 buf = ReasonBuffer2.forAll("prefix A");
    final ReasonBuffer2 buf2 = ReasonBuffer2.forAll("prefix B");
    buf.append(true, "reason #1");
    buf.append(false, "reason #2");
    buf.append(true, "reason #3");
    buf.append(false, "reason #4");
    buf.append(true, "reason #5");
    buf.append(true, "reason #6");
    Assertions.assertThat(buf.getReason()).isEqualTo("prefix A: reason #1; reason #3; reason #5; reason #6");
}
Also used : ReasonBuffer2(org.estatio.module.base.platform.applib.ReasonBuffer2) Test(org.junit.Test)

Example 20 with ReasonBuffer2

use of org.estatio.module.base.platform.applib.ReasonBuffer2 in project estatio by estatio.

the class ReasonBuffer2_Test method with_prefix.

@Test
public void with_prefix() throws Exception {
    final ReasonBuffer2 buf = ReasonBuffer2.forAll("Cannot change");
    buf.append(true, "reason #1");
    buf.append(false, "reason #2");
    buf.append(true, "reason #3");
    Assertions.assertThat(buf.getReason()).isEqualTo("Cannot change: reason #1; reason #3");
}
Also used : ReasonBuffer2(org.estatio.module.base.platform.applib.ReasonBuffer2) Test(org.junit.Test)

Aggregations

ReasonBuffer2 (org.estatio.module.base.platform.applib.ReasonBuffer2)40 Test (org.junit.Test)10 DomainObject (org.apache.isis.applib.annotation.DomainObject)7 IncomingInvoice (org.estatio.module.capex.dom.invoice.IncomingInvoice)1 IncomingInvoiceItem (org.estatio.module.capex.dom.invoice.IncomingInvoiceItem)1 InvoiceItem (org.estatio.module.invoice.dom.InvoiceItem)1