/*
 * Copyright (c) www.bugull.com
 * 
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.bugull.mongo.crud;

import com.bugull.mongo.base.ReplicaSetBaseTest;
import com.bugull.mongo.dao.AccountDao;
import com.bugull.mongo.entity.Account;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
import org.junit.Test;

/**
 *
 * @author Frank Wen(xbwen@hotmail.com)
 */
public class AccountTest extends ReplicaSetBaseTest {
    
    //@Test
    public void testInsert(){
        connectDB();
        
        Account account = new Account();
        account.setName("Jessica");
        account.setMoney(BigDecimal.valueOf(9999.99));

        new AccountDao().insert(account);
        
        disconnectDB();
    }
    
    //@Test
    public void testQuery(){
        connectDB();
        
        AccountDao dao = new AccountDao();
        Account account = dao.findOne();
        System.out.println("name: " + account.getName());
        BigDecimal bd = account.getMoney();
        System.out.println("money: " + bd.toString());
        
        disconnectDB();
    }
    
}

@@ -624,16 +624,51 @@
 .crud;%0A%0A
+import com.bugull.mongo.BuguQuery;%0A
 import c
@@ -821,59 +821,8 @@
 al;%0A
-import java.util.ArrayList;%0Aimport java.util.List;%0A
 impo
@@ -1598,10 +1598,325 @@
  %7D%0A    %0A
+    @Test%0A    public void testUpdate()%7B%0A        connectDB();%0A        %0A        AccountDao dao = new AccountDao();%0A        BuguQuery%3CAccount%3E query = dao.query().is(%22name%22, %22Frank%22);%0A        dao.update().set(%22money%22, new BigDecimal(%226666%22)).setUpsert(true).execute(query);%0A        %0A        disconnectDB();%0A    %7D%0A    %0A
 %7D%0A

add some JUnit test code