亚洲国产日韩欧美一区二区三区,精品亚洲国产成人av在线,国产99视频精品免视看7,99国产精品久久久久久久成人热,欧美日韩亚洲国产综合乱

? Java Java???? ????? ??? ?????(JUnit) ??

????? ??? ?????(JUnit) ??

Nov 29, 2021 am 09:33 AM
junit

Junit ?????:

Junit? ?? ?? Java ?? ??? ????????.

??? junit5? ???????. junit5? Junit Platform, Junit Jupiter, Junit Vintage ? ? ?? ?? ???? ??? ???? ????. Java 8 ??? ?????. ??? ???? ???? IntelliJ IDEA???. ?? ????? ??? ?????? ???? ?? ??? ???? ???. ? ?? ??? ???? ????? ????? Junit? ?? ???? ???? ?????. ?? ?? ?? ??? ??? ????.

?? ??? ??? ??? ?? ?? ??? ??? ??, ?? ? ?????.

Junit? ????? ???? ?? ?????.

1. ??? ?? ??: ?? ?? ??? ?? ??? ??? ?????.

2. ??? ?? ??: ??? ??? ?? ??? ???? ???? ???? ???? ?? ???? ?????. ????? ??? ?? ????? ??? ???? ?? ???? ??? ?? ??? ???? ?????.

3. ??? ?? ??: ??? ???? ???? ??? ??? ????.

4. ??? ?? ??: ??? ??? ??? ?? ??? ????, ??? ??? ????, ??? ?? ?????.

???? ?? ??? ???????.

@Test: ??? ???? ?? ??? ??? ?????.

@ParameterizedTest: ???? ??? ????? ?????. ?? ? ??? ???? ?? ??? ???? ??? ???? ?? ? ??? ?? ????.

@RepeatedTest: ? ??? ???? ??? ????? ?? ?? ??? ?? ??? ? ????.

@TestFactory: ???? ??? ?? ?? ??? ??? ??? ???? ?? ?????.

@Displayname: ??? ??? ?? ??? ???? ?? ??? ?? ?? ??? ?????.

@BeforeEach: ? ??? ???? ???? ?? ??? ???? ???? ?????.

@AfterEach: ? ??? ???? ??? ?? ??? ???? ???? ?????.

@BeforeAll: ?? ???? ?? ??? ????? ?? ???? ? ????? ?? ??? ??? ??? ? ????.

@AfterAll: ?? ???? ?? ??? ??? ??? ?????.

@Disabled: ??? ??? ?? ???? ???? ??? ?????.

???:

??: ??? ???? ??????.

AssertTrue/asserFalse: ? ?? ??? ?????.

AssertNull/assertNotNull: Assert? null??? null? ????.

assertEquals/assertNotEquals: ? ?? ???? ??? ?????.

AssertArrayEquals: ?? ?? ??? ????? ?????.

AssertSame/assertNotSame: ? ??? ???? ??? ?????.

AssertThrows/assertDoesNotThrow: ??? ????? ??? ?????.

AssertAll: ?? ??? ????? ??

???? ???? ??? ?? ???? ????.

package test;//包機(jī)制
import java.lang.reflect.Array;
public class MixedOperation {
    public int mixeOperation(int x,int y){
        return division((x+y),y);
    }
    public int division(int x,int y){
        int result=(x/y);
        return result;
    }
    public static void main(String[] args) {
      MixedOperation mixedOperation=new MixedOperation();
      System.out.println(mixedOperation.mixeOperation(5,1));
    }
}

MixedOperation??? ???? ????.

package test;
import org.junit.jupiter.api.*;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.CsvSource;
public class MixedOperationTest {
    private MixedOperation mixedOperation;
    @BeforeEach
    public void init(){
      mixedOperation=new MixedOperation();
    }
    @Test
    public void successTest(){
        System.out.println("run a test:x=4,y=2");
        int result=mixedOperation.mixeOperation(4,2);
        Assertions.assertEquals(3,result);
    }
   /* @DisplayName("失敗")
    public void errorTest(){`
        System.out.println("run a test:x=4,y=0");
        ArithmeticException exception=new ArithmeticException(
                ArithmeticException.class -> {
            mixedOperation.mixeOperation(4, 0);
        }
        );
    }*/
    @Disabled("參數(shù)")
    @Test
    @DisplayName("參數(shù)")
    @ParameterizedTest
    @CsvSource({"6,3,3","5,2,3","6,2,4"})
    public void caTest(int x,int y,int excepted){
        System.out.println("run a test :x="+x+"y="+y);
        System.out.println(excepted);
        int t= mixedOperation.mixeOperation(x,y);
        Assertions.assertEquals(excepted,t);
    }
    @Disabled
    @Test
    public void  Next(){
       System.out.println("拋出一個(gè)異常");
       System.out.println(Assertions.assertThrows(IllegalArgumentException.class, () ->mixedOperation.mixeOperation(2,0)));
    }
    @Disabled
    @Test
    void error(){
        Assertions.assertThrows(Exception.class,()->{Assertions.assertEquals(1,0);});
    }
    @Test
    void sure(){
        int result=mixedOperation.mixeOperation(4,2);
        Assertions.assertTrue(3==result);//斷言相等
    }
}

??? MixedOperationTest Class?? ???? ????. ??: "

java ??? ????

"

? ??? ????? ??? ?????(JUnit) ??? ?? ?????. ??? ??? PHP ??? ????? ?? ?? ??? ?????!

? ????? ??
? ?? ??? ????? ???? ??? ??????, ???? ?????? ????. ? ???? ?? ???? ?? ??? ?? ????. ???? ??? ???? ???? ??? ?? admin@php.cn?? ?????.

? AI ??

Undresser.AI Undress

Undresser.AI Undress

???? ?? ??? ??? ?? AI ?? ?

AI Clothes Remover

AI Clothes Remover

???? ?? ???? ??? AI ?????.

Video Face Swap

Video Face Swap

??? ??? AI ?? ?? ??? ???? ?? ???? ??? ?? ????!

???

??? ??

???++7.3.1

???++7.3.1

???? ?? ?? ?? ???

SublimeText3 ??? ??

SublimeText3 ??? ??

??? ??, ???? ?? ????.

???? 13.0.1 ???

???? 13.0.1 ???

??? PHP ?? ?? ??

???? CS6

???? CS6

??? ? ?? ??

SublimeText3 Mac ??

SublimeText3 Mac ??

? ??? ?? ?? ?????(SublimeText3)

???

??? ??

??? ????
1597
29
PHP ????
1488
72
???
JUnit ?? ??? ?????: ??? ??? ?? JUnit ?? ??? ?????: ??? ??? ?? Apr 18, 2024 pm 09:18 PM

JUnit ?? ??? ?????? ???? ???, ?? ???, ??? ?? ?? ? ???? ?? ???? ?? ?? ???? ?????. ??? ??? ??, ?? ?? ??, ???, ??? ??, ???? ?? ?? ?? ?? ?? ??? ????. Java ??????? ?? ???? ?? JUnit? ?? ??? ???? ??? ???????? ?? ? ?? ??? ???? ???.

JUnit ?????? ??? ???? ??? ??? ?????? JUnit ?????? ??? ???? ??? ??? ?????? May 06, 2024 pm 05:33 PM

JUnit ?????? ??? ??? ???? ???? ???? ? ?????. ?? ???? @Test(??? ??? ??), @Before(??? ???? ???? ?? ???? ???), @After(??? ??? ?? ???? ???)? ?????. ???), @BeforeClass(?? ??? ???? ???? ?? ???? ???), @AfterClass(?? ??? ???? ??? ?? ???? ???) ??? ??? ??? ??? ???? ????? ??? ??? ???? ????? ? ??? ???. ??? ??? ??? ???? ???? ?? ???? ?????.

JUnit ?? ??? ?????: ???? ?? ???? JUnit ?? ??? ?????: ???? ?? ???? Apr 18, 2024 pm 01:51 PM

JUnit? ?????? ?? ??? ????? ?? ??? ??? ???? Java? ?? ??? ????????. ???? ???? @Test ??? ??? ?? ??? ???? ???? ???? ?????, AssertEquals? ?? ??? ???? ???? ?? ?? ?? ?? ??? ? ????. JUnit? ?? ??, ?? ???, ?? ?? ????? ?? ?? ??? ?????.

?? ??? ???? JUnit ?? ??? ????? ?? ?? ??? ???? JUnit ?? ??? ????? ?? Apr 18, 2024 pm 03:12 PM

?? ??? ???? JUnit? ??? ? ?? ??? ???? ?? ??? ????? ? ?? ???? ?? ??? ????. ?? ??? ???? ??? ??? ???? ?? ?? ????? ???? ??, ?? ??? ???? ??? ????? ???? ?? ???? ???? ??? ???? ??? ?? ??? ?????. ???? ?? ???? ConcurrentHashMap? ???? ?-? ?? ???? ?? ?? ?? ?????? ??? ??? ????? ?? ?? ???? ???? ?-? ?? ?? ???? ? ???? ???? ?? ??? ???? JUnit? ??????? ???? ???? ?????. .

JUnit ?? ??? ?????: ???? ??? ?? ?? ?? ??? JUnit ?? ??? ?????: ???? ??? ?? ?? ?? ??? Apr 18, 2024 pm 04:51 PM

JUnit ?? ??? ?????? ???? ??? ?? ??? ????? ??? ? ????. ???? ?? ???? ???? ?? ?? ?? ? ??? ?? ???? ?????. JUnit? ?? ??? ?? ?? ??? ???? ???? ?? ???? ??? ?????. ?? ???? ?? ?? ??, ?? ??, ??? ??? ??, try-with-resources ? ??? ?????. ??? ??? ??? ???? ????? ???? JUnit ??? ??? ?? ? ????.

Spring ?????? JUnit ?? ??? ????? ?? Spring ?????? JUnit ?? ??? ????? ?? Apr 18, 2024 pm 04:54 PM

JUnit? Spring ?????? ?? ???? Java ?? ??? ??????? ?? ??? ?? ??? ? ????. JUnit ??? ??: org.junit.jupiterjunit-jupiter5.8.1test ??? ??? ??: @ExtendWith(SpringExtension.class)? ???? ??? ??????. @Autowired ?? ?? ????, @BeforeEach ? @AfterEach? ???? ?? ? ????, @Test? ??? ???? ?????.

Java? JUnit ?? ??? ?????? ?? ?? ??? ?????? Java? JUnit ?? ??? ?????? ?? ?? ??? ?????? Apr 18, 2024 pm 09:03 PM

JUnit ?? ??? ?????? ?? ??? ??? ???? ?? ??? ?????. ???? ??? ?? ??? ??? ??? ?? ???? ???? ??? ???? ????? ?? ?? ??(???? ??) ???? ??? ?? Mocking ? Stubbing? ???? ??? ?? ?? ?? ?? ?? ??? ???? ??? ??? ????? ??

JUnit ?? ??? ?????: ??? ???? ??? ??? ??? ?? ? JUnit ?? ??? ?????: ??? ???? ??? ??? ??? ?? ? Apr 18, 2024 pm 03:54 PM

JUnit??? @RunWith ??? ???? BlockJUnit4ClassRunner ???? ???? ??? ???? ??? ???? ??? ? ????. ??? ?? ???? ??? ???? ?? ???? ?????. ?? ??? ???? ?? ??? ????? System.out.println()? ??????. JUnitAssert ??? ???? ???? ?? ?? ?? ?? ?????.

See all articles