@@ -0,0 +1,1944 @@
+/*%0A * Copyright (c) www.bugull.com%0A * %0A * Licensed under the Apache License, Version 2.0 (the %22License%22);%0A * you may not use this file except in compliance with the License.%0A * You may obtain a copy of the License at%0A *%0A *      http://www.apache.org/licenses/LICENSE-2.0%0A *%0A * Unless required by applicable law or agreed to in writing, software%0A * distributed under the License is distributed on an %22AS IS%22 BASIS,%0A * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0A * See the License for the specific language governing permissions and%0A * limitations under the License.%0A */%0A%0Apackage com.bugull.mongo.crud;%0A%0Aimport com.bugull.mongo.BuguUpdater;%0Aimport com.bugull.mongo.base.BaseTest;%0Aimport com.bugull.mongo.dao.UserDao;%0Aimport com.bugull.mongo.entity.User;%0Aimport org.junit.Test;%0A%0A/**%0A *%0A * @author Frank Wen(xbwen@hotmail.com)%0A */%0Apublic class FindAndModifyTest extends BaseTest %7B%0A    %0A    @Test%0A    public void testFindAndModify()%7B%0A        connectDB();%0A        %0A        UserDao userDao = new UserDao();%0A        BuguUpdater updater1 = userDao.update().set(%22age%22, 35);%0A        User user1 = userDao.findAndModify(%22username%22, %22frank%22, updater1);%0A        System.out.println(%22age before: %22 + user1.getAge());%0A        %0A        BuguUpdater updater2 = userDao.update().set(%22age%22, 36);%0A        User user2 = userDao.findAndModify(%22username%22, %22frank%22, updater2, true);%0A        System.out.println(%22age after: %22 + user2.getAge());%0A        %0A        disconnectDB();%0A    %7D%0A    %0A    //@Test%0A    public void testFindAndRemove()%7B%0A        connectDB();%0A        %0A        UserDao userDao = new UserDao();%0A        User user1 = userDao.findAndRemove(%22username%22, %22frank%22);%0A        System.out.println(%22user before remove: %22 + user1.getUsername());%0A        %0A        User user2 = userDao.findOne(%22username%22, %22frank%22);%0A        if(user2==null)%7B%0A            System.out.println(%22user not exists!%22);%0A        %7D%0A        %0A        disconnectDB();%0A    %7D%0A%0A%7D%0A

add FindAndModify junit test