在mongoDB中测试,不希望启动其他插件
package com.dxhy.basic.email.sender.bean;import org.junit.Test;import org.junit.runner.RunWith;import org.springframework.beans.factory.annotation.Autowired;import org.springframework.boot.autoconfigure.data.mongo.MongoDataAutoConfiguration;import org.springframework.boot.autoconfigure.mongo.MongoAutoConfiguration;import org.springframework.boot.test.context.SpringBootTest;import org.springframework.data.mongodb.core.MongoTemplate;import org.springframework.test.context.junit4.SpringRunner;/** * 测试pdf通过uuid下载 * Created by 赵睿 on 2017/4/6. */@RunWith(SpringRunner.class)@SpringBootTest(classes = {MongoAutoConfiguration.class,MongoDataAutoConfiguration.class})public class DownLoadTest { @Autowired private MongoTemplate mongoTemplate; @Test public void getDownLoad(){ DownLoad downLoad=mongoTemplate.findById("22b5d67f-6037-455c-bf6f-e7501f956780",DownLoad.class); System.out.println(downLoad.getBytes().length); }}