EasyMock???????????
???????????? ???????[ 2014/12/24 15:54:05 ] ????????EasyMock ???????
????????????????????????????????????????£????????????????μ??????????????????????????????????????8000.00???????1520.00????÷???193.00????????????????????????Mock?????????????????????????????????????????????????????????????????????
/**
* Copyright ? 2008-2013?? WheatMark?? All Rights Reserved
*/
package com.fitweber.wheat.test;
import static org.easymock.EasyMock.*;
import junit.framework.Assert;
import org.easymock.IMocksControl;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import com.fitweber.wheat.Accountant;
import com.fitweber.wheat.interfaces.IPersonalIncomeTax;
/**
* ??????????
* @author wheatmark hajima11@163.com
* @Blog http://blog.csdn.net/super2007
* @version 1.00.00
* @project wheatMock
* @file com.fitweber.wheat.test.AccountantTest.java
* @bulidDate 2013-9-1
* @modifyDate 2013-9-1
* <pre>
* ?????
* ????汾: ?????? ???????: ???????:
* </pre>
*/
public class AccountantTest {
private IPersonalIncomeTax personalIncomeTax;
private Accountant accountant;
/**
* @throws java.lang.Exception
*/
@Before
public void setUp() throws Exception {
IMocksControl control = createControl();
personalIncomeTax = control.createMock(IPersonalIncomeTax.class);
accountant = new Accountant();
accountant.setPersonalIncomeTax(personalIncomeTax);
}
/**
* @throws java.lang.Exception
*/
@After
public void tearDown() throws Exception {
System.out.println("----------AccountantTest?е???????????????---------");
}
@Test
public void testCalculateSalary(){
//??????????????????????????????????????????д?????????????
//?????????Mock????????????
//???????????????????????????????????8000.00???????1520.00????÷???193.00.
expect(personalIncomeTax.calculate(8000.00??1520.00)).andReturn(193.00);
//??????????
replay(personalIncomeTax);
//????????????????????????
Assert.assertEquals(8000.00-1520.00-193.00?? accountant.calculateSalary(8000.00));
verify(personalIncomeTax);
}
}
|
????4. ??в???
???????????????????????AccountantTest.java??Run As —> JUnit Test???????????????檔
???????????????????????漰???????????????????SPASVOС??(021-61079698-8054)?????????????????????????
??????
iOS???????mocha??chai??sinon??istanbul???????????????????????????????????????д?????Java????????7??????Android?????????Robolectric3.0????(?)???Kiwi?????????????????????????????????Python?????????????????????????????????????Controller????????д?????????10???????????????????Angular????????????Component??Directive??Pipe ???ServiceAndroid????????????????????????????????--Mockito??????iOS UnitTest???????Vue?????????????????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11????????
?????????App Bug???????????????????????Jmeter?????????QC??????APP????????????????app?????е????????jenkins+testng+ant+webdriver??????????????JMeter????HTTP???????Selenium 2.0 WebDriver ??????