首页 > 代码库 > 第三次作业

第三次作业

Junit4测试:

<dependency>                    

                      <groupId>junit</groupId>                    
                      <artifactId>junit</artifactId>                    
                      <version>4.8.2</version>                    
                      </dependency>                    
                      <dependency>                    
                      <groupId>org.jmock</groupId>                    
                      <artifactId>jmock</artifactId>                    
                      <version>2.5.1</version>                    
                      </dependency>                    
                      <dependency>                    
                      <groupId>org.jmock</groupId>                    
                      <artifactId>jmock-junit4</artifactId>                    
                      <version>2.5.1</version>                    
                      </dependency>                    
                      <dependency>                    
                      <groupId>org.hamcrest</groupId>                    
<artifactId>hamcrest-core</artifactId>
                      <version>1.2.1</version>                    
                      </dependency>                    
                        package cn.javass;                      
                        import org.junit.Assert;                      
                        import org.junit.Test;                      
                        public class TestDivide1 {                      
                        @Test                      
                        public void test1(){                      
                        Divide divide = new Divide();                      
                        final int expected = 3;                      
                        final int actual = divide.devide(7, 2);                      
                        Assert.assertEquals(expected, actual);                      
                        }                      
                        }
运行测试类:
 
技术分享
测试结果:
 
技术分享

第三次作业