Spring-boot快速开发

15 篇文章 1 订阅

jeecg-boot:一键生成Spring-boot系统
awesome-spring-boot:收集各种 Spring Boot 学习资源
jeeSpringCloud 基于SpringBoot2.0的后台权限管理系统界面简洁美观敏捷开发系统架构。核心技术采用Spring、MyBatis、Shiro没有任何其它重度依赖。
springboot-plus 基于SpringBoot 2的开源管理后台系统
mall:一个电商系统,包括后台管理和前台商品展示
litemall : 一个商城项目,包括Spring Boot后端 + Vue管理员前端 + 微信小程序用户前端 + Vue用户移动端
cloud-platform 脚手架,统一授权
微人事 是一个前后端分离的人力资源管理系统,项目采用 SpringBoot + Vue 开发
spring-boot-pay 一个支付案例,提供了包括支付宝、微信、银联在内的详细支付代码案例
秒杀系统 从0到1构建分布式秒杀系统
V部落多用户博客 V部落是一个多用户博客管理平台,采用 Vue + SpringBoot开发
My-Blog由 SpringBoot + Mybatis + Thymeleaf 等技术实现的 Java 博客系统

单元测试模板类

package com;

import lombok.extern.slf4j.Slf4j;
import org.junit.FixMethodOrder;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.MethodSorters;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.junit4.SpringRunner;

/**
 * Created by liufang on 2019/6/19.
 */
@RunWith(SpringRunner.class)
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = App.class)
@ActiveProfiles("dev")
@AutoConfigureMockMvc
@Slf4j
@FixMethodOrder(MethodSorters.NAME_ASCENDING)//指定测试方法按字母的顺序执行
public class ServiceTest {
    @Autowired
    private MockMvc mockMvc;

    @Autowired
    private TestRestTemplate restTemplate;
   
    @Test
    public void exampleTest() {
        String body = this.restTemplate.getForObject("/test", String.class);
        assertThat(body).isEqualTo("hello world");
    }

    @Test
    public void test() throws Exception {
        this.mockMvc.perform(get("/test"))
                .andDo(print())
                .andExpect(status().isOk())
                .andExpect(content().string("hello world"));

    }
}
  • 2
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值