package org.docksidestage.dockside.dbflute.whitebox.cbean.bigartist.derivedreferrer;

import org.docksidestage.dockside.dbflute.exbhv.MemberBhv;
import org.docksidestage.dockside.unit.UnitContainerTestCase;

/**
 * @author jflute
 * @since 1.1.0 (2014/10/20 Monday)
 */
public class WxCBDerivedReferrerDerivedMapTest extends UnitContainerTestCase {

    // ===================================================================================
    //                                                                           Attribute
    //                                                                           =========
    @SuppressWarnings("unused")
    private MemberBhv memberBhv;

    // TODO jflute test: derived map
}

@@ -138,16 +138,75 @@
 berBhv;%0A
+import org.docksidestage.dockside.dbflute.exentity.Member;%0A
 import o
@@ -259,16 +259,16 @@
 stCase;%0A
-
 %0A/**%0A * 
@@ -679,40 +679,8 @@
 ===%0A
-    @SuppressWarnings(%22unused%22)%0A
     
@@ -709,16 +709,16 @@
 erBhv;%0A%0A
-
     // T
@@ -745,11 +745,1026 @@
 ived map
+%0A%0A    public void test_DerivedMap_basic() throws Exception %7B%0A        // ## Arrange ##%0A        String aliasName = %22$maxPrice%22;%0A%0A        // ## Act ##%0A        Member member = memberBhv.selectEntity(cb -%3E %7B%0A            cb.specify().derivedPurchase().max(purchaseCB -%3E %7B%0A                purchaseCB.specify().columnPurchasePrice();%0A            %7D, aliasName);%0A            cb.query().existsPurchase(purchaseCB -%3E %7B%7D);%0A            cb.fetchFirst(1);%0A        %7D);%0A%0A        // ## Assert ##%0A        memberBhv.loadPurchase(member, purchaseCB -%3E %7B%0A            purchaseCB.specify().columnPurchasePrice();%0A            purchaseCB.query().addOrderBy_PurchaseDatetime_Asc();%0A        %7D);%0A        member.derived(aliasName, Integer.class).alwaysPresent(price -%3E %7B%0A            log(price);%0A            Integer expected = member.getPurchaseList().stream().map(purchase -%3E %7B%0A                return purchase.getPurchasePrice();%0A            %7D).max((o1, o2) -%3E o1.compareTo(o2)).get();%0A            assertEquals(expected, price);%0A        %7D);%0A    %7D
 %0A%7D%0A

test OK