⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 pricingmgmtservicetest.java

📁 当时就海底世界没客服热线mkxmykm,xkxtml, xrtlujlnszltrikxrseher
💻 JAVA
字号:
package com.tarena.oss.test;

import java.util.Collection;

import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import com.tarena.oss.pricing.pojo.Pricing;
import com.tarena.oss.pricing.pojo.PricingConditionDTO;
import com.tarena.oss.pricing.service.PricingMgmtService;

public class PricingMgmtServiceTest extends TestCase {
	private PricingMgmtService service;
	private ApplicationContext context;
	
	public PricingMgmtServiceTest(String name) {
		super(name);
	}

	protected void setUp() throws Exception {
		context = new ClassPathXmlApplicationContext("applicationContext.xml");
		service = (PricingMgmtService)context.getBean("pricingServiceProxy");
	}

	protected void tearDown() throws Exception {
		context = null;
		service = null;
	}

	public void testFindAll() {
		Collection<Pricing> ps = service.findAll();
		System.out.println(ps);
	}

	public void testFindAllByCondition() {
		PricingConditionDTO dto = new PricingConditionDTO();
		dto.setName("资");
		Collection<Pricing> ps = service.findAllByCondition(dto);
		System.out.println(ps);
	}

	public void testAddPricing() {
		Pricing p = new Pricing(null, "套餐一", 10, 0.8, "通过JUnit测试");
		service.addPricing(p);
	}

	public void testModifyPricing() {
		Pricing p = service.findPricingById(1);
		p.setName("资费二");
		service.modifyPricing(p);
	}

	public void testFindPricingById() {
		Pricing p = service.findPricingById(1);
		System.out.println(p);
	}

	public void testRemovePricing() {
		service.removePricing(2);
	}

	public static Test suite(){
		TestSuite suite = new TestSuite();

		suite.addTest(new PricingMgmtServiceTest("testAddPricing"));
		suite.addTest(new PricingMgmtServiceTest("testFindAll"));
		suite.addTest(new PricingMgmtServiceTest("testFindAllByCondition"));
		suite.addTest(new PricingMgmtServiceTest("testFindPricingById"));
		suite.addTest(new PricingMgmtServiceTest("testModifyPricing"));
		suite.addTest(new PricingMgmtServiceTest("testRemovePricing"));
		suite.addTest(new PricingMgmtServiceTest("testFindAll"));
		
		return suite;
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -