Search in sources :

Example 21 with ReasonBuffer2

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

the class ReasonBuffer2_Test method with_no_prefix.

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

Example 22 with ReasonBuffer2

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

the class ReasonBuffer2_Test method with_null_reasons.

@Test
public void with_null_reasons() throws Exception {
    final ReasonBuffer2 buf = ReasonBuffer2.forAll();
    buf.append(true, null);
    Assertions.assertThat(buf.getReason()).isNull();
}
Also used : ReasonBuffer2(org.estatio.module.base.platform.applib.ReasonBuffer2) Test(org.junit.Test)

Example 23 with ReasonBuffer2

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

the class ReasonBuffer2_Test method using_lazy_reasons.

@Test
public void using_lazy_reasons() throws Exception {
    final ReasonBuffer2 buf = ReasonBuffer2.forAll("Cannot change");
    buf.append(() -> "reason #1");
    buf.append(() -> null);
    buf.append((ReasonBuffer2.LazyReason) null);
    buf.append(() -> "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)

Example 24 with ReasonBuffer2

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

the class IncomingInvoiceDownloadManager method disableReport.

public String disableReport() {
    ReasonBuffer2 buf = ReasonBuffer2.forSingle();
    buf.append(getReportedDate() != null, "Clear 'report date' in order to report on all items currently unreported.");
    buf.append(getInvoices().isEmpty(), "No invoices");
    return buf.getReason();
}
Also used : ReasonBuffer2(org.estatio.module.base.platform.applib.ReasonBuffer2)

Example 25 with ReasonBuffer2

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

the class OrderItem method disableUpdateAmounts.

public String disableUpdateAmounts() {
    ReasonBuffer2 buf = ReasonBuffer2.forSingle();
    itemImmutableIfOrderImmutable(buf);
    return buf.getReason();
}
Also used : ReasonBuffer2(org.estatio.module.base.platform.applib.ReasonBuffer2)

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