Java ??????? ?? ???? ???? Junit ??? ??? ?? ??? ????? ???? ??? ? ????. 1. ??? ???? ???? Maven ?? Gradle? ???? Junit Jupiter? API ? ?? ???? ??????. 2. ??? ???? ???? @Test ??? ???? ??? ??? ???? ?? ?? ??? ?? ?? ? ??? ??????. 3. @beforeeach, @aftereach, @beforeall ? @afterall? ???? ??? ????? ?????. 4. AsserTequals, AssertTrue, AssertNull ? AsserTThrows? ???? ?? ? ?? ??? ???? ???? ???? ???? ?????.
?? ???? ????? ??? ?? ??? ??, ?? Java ?????? ?? ????? ???? ??? ??? ?? ? ?????. ?? ?? ???? ???? ???? ??? ??? ? ???? ? ??? ??? ? ?? ?? ?? ? ????? ???? ??? ? ????.

1. ??? ??? ??
Java ?????? Junit? ????? ?? ????? ??? ???? ???????. ???? ?? Java ????? Maven ?? Gradle? ???? ???? ?????.

-
Maven :
pom.xml
? ?? ??? ??????.<???> <groupid> org.junit.jupiter </groupid> <artifactid> junit-jupiter-api </artifactid> <??> 5.10.0 </??> <Scope> ??? </scope> </???> <???> <groupid> org.junit.jupiter </groupid> <artifactid> junit-jupiter-engine </artifactid> <??> 5.10.0 </??> <Scope> ??? </scope> </???>
Gradle :
build.gradle
??? ?????.?? 'org.junit.jupiter : junit-jupiter-api : 5.10.0' testruntimeonly 'org.junit.jupiter : junit-jupiter-Engine : 5.10.0'
?? ??? ??? ?? ??? ? ????. ?? Junit 4? ?? ?? ?? Junit Jupiter (?, Junit 5)? ???? ?? ????.
2. ? ?? ??? ???? ??????
????? ? ???? ???? ???? ??? ???? ????. ?? ??, Calculator
?????? ?? CalculatorTest
???? ?? ? ????.
import org.junit.jupiter.api.test; static org.junit.jupiter.api.assertions? ?????.*; ??? calculatortest { @?? void add_shouldReturnCorRectresult () { ??? ??? = ??? ??? (); int ?? = ?? (2, 3); Assertequals (5, ??); } }
? ?? ?? :
-
@Test
??? ???? ??? ????? ??????. - ?? Import
org.junit.jupiter.api.Assertions.*
? ???? ?? ????.assertEquals
? ?? ?? ? ??? ?? ??? ? ????. - ??? ?? ?? ??? ??
add_shouldReturnCorrectResult
? ?? ??? ??? ???? ???????.
3. ???? ?? ? ???? ??? ??????
Junit? ??? ??? ??? ?? ??? ???? ? ????? ???? ?? ??? ?????.
-
@BeforeEach
: ? ??? ??? ???? ?? ??????. -
@AfterEach
: ? ??? ??? ?? ? ? ??????. -
@BeforeAll
: ?? ??? ???? ???? ?? ? ? ?????? (????? ?? ???). -
@AfterAll
: ?? ??? ???? ??? ? ? ? ?????? (?? ?? ???).
?? ??:
@beforeeach void setup () { // ?? ??, ?????? ?? ?? ?? ??? ???}} @aftereach ?? ?? () { // ??? ??}
? ??? ?? ??? ??? ?? ?? ??? ?? ??? ???? ? ?????.
4. ?? ? ?? ???
Junit? ?? assertEquals
??? ??? ?? ?? ?? ??? ?????.
-
assertTrue(boolean condition)
-
assertNull(Object object)
-
assertThrows(Class<T> expectedType, Executable executable)
: ??? ??? ????? ????? ? ?????.
?? ??:
@?? void divide_shouldthrowexceptionwhendividebyzero () { ??? ??? = ??? ??? (); AssertThrows (arithmeticexception.class, () -> calculate.divide (10, 0)); }
? ???? ??? 0 ? ? ??? ???? ????? ??? ?????.
????? ?? ??. ?? ??? ? ???, ??? ??? ?? ?? Junit?? ?? ??? ??? ?? ??? ???? ?? ??? ????? ???? ????? ?? ????? ?????. ????? ??? ???? ?? ?? ??? ?? ? ?? ?? ????? ???? ?? ?? ? ??? ???? ??? ????.
? ??? Junit? ?? Java?? ?? ???? ???? ??? ??????? ?? ?????. ??? ??? PHP ??? ????? ?? ?? ??? ?????!

? AI ??

Undress AI Tool
??? ???? ??

Undresser.AI Undress
???? ?? ??? ??? ?? AI ?? ?

AI Clothes Remover
???? ?? ???? ??? AI ?????.

Clothoff.io
AI ? ???

Video Face Swap
??? ??? AI ?? ?? ??? ???? ?? ???? ??? ?? ????!

?? ??

??? ??

???++7.3.1
???? ?? ?? ?? ???

SublimeText3 ??? ??
??? ??, ???? ?? ????.

???? 13.0.1 ???
??? PHP ?? ?? ??

???? CS6
??? ? ?? ??

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

??? ??











Java? ?? ??? ????? ? ?? ???? ?? ??: ?????? ?? ??? ???? ????. ????? ???? ???? ?? ???? ????. Mockito ?????? ???? ????? ???? ???? ??? ???? ??????. ?? ???? ??? ???? ?????. ?? ???? ?? ???? ????. ?? ???? ???? ????? ??? ???? ?????.

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

PHP ?? ??? ?? ??: PHPUnit: ??? ????? ???? ???? ??? ???? ??? ??? ???? ?? ? ????. PHPUnitWrapper: ??? ????? ???? ???? ?? Lumen/Laravel? ????? ??? ??? ????? ?? ?? ?? ??? ???? ??? ???? ??? ???? ????.

Go ?? ?? ????? ?? ??? ?? ? ?? ?? ??? ????. 1. ?? ?? ???? ? ???? ?? ??? ?? ??? ??? ?????. 2. ??? ??? ??? ???? ?? ??? ?????. ?? ?? ??? ????? ? ?????. ?? ????? ??? ?? ??? ?? 0? ????? ???? ?? ?? ? ??? ?????.

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

??? ?? ???? ???? ?? ?? ? ?? ??? ???? Go ?? ????? ??? ?? ??? ??????. ???? ??? ?????. 1. ??? ??? ??? ???? ????? ?????. 2. ????? ???? ??? ?? ??? ?????. ?? ????? ???? ???? ???? ??? ?? ??? ????? ???? ?????, gotest? ???? ???? ????? ?? ??? ?????.

???, ???, ?? ??? ? ??? ????? ??? ???? ???? ?? ??? ???? ???? ?? ?????. ???? ???? ?? ??, ??? ???? ??, ??? ?? ? ??? ??? ??? ?????. ?? ????? max() ??? ?? ??? ?? ??? ???? ?? ??? ????? ??? ???? ?????. ??? ??? ??? ??? ?? ??? ???? ???? ? ????.

Golang ?? ????? ???? Gomega? ???? ?? Golang ?? ????? Gomega? ???? ??? ??? ?? ??? ? ??? ??? ??? ??? ???? ?? ?? ??? ??? ????????. Gomegagoget-ugithub.com/onsi/gomega ?? ???? Gomega ?? ??? ???? Gomega? ???? ? ?? ???? ????. 1. ?? ??? import "github.com/onsi/gomega" funcTest_MyFunction(t*testing.T){
