-
-
Notifications
You must be signed in to change notification settings - Fork 365
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
adammasyk
committed
Mar 19, 2020
1 parent
244d3da
commit 62b120a
Showing
2 changed files
with
174 additions
and
0 deletions.
There are no files selected for viewing
69 changes: 69 additions & 0 deletions
69
library/src/test/java/com/chuckerteam/chucker/MockTransactionFactory.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
import com.chuckerteam.chucker.internal.data.entity.HttpTransaction | ||
import java.util.Date | ||
|
||
object MockTransactionFactory { | ||
|
||
internal fun createTransaction(method: String): HttpTransaction { | ||
return HttpTransaction( | ||
0, Date(1300000).time, Date(1300300).time, | ||
1000L, "HTTP", method, "http://localhost/getUsers", | ||
"localhost", "/getUsers", "", "", "", | ||
1000L, "application/json", null, | ||
null, true, 200, "OK", | ||
null, 1000L, "application/json", | ||
null, """{"field": "value"}""", true, null | ||
) | ||
} | ||
|
||
val expectedGetHttpTransaction = | ||
"""URL: http://localhost/getUsers | ||
Method: GET | ||
Protocol: HTTP | ||
Status: Complete | ||
Response: 200 OK | ||
SSL: No | ||
Request time: ${Date(1300000)} | ||
Response time: ${Date(1300300)} | ||
Duration: 1000 ms | ||
Request size: 1.0 kB | ||
Response size: 1.0 kB | ||
Total size: 2.0 kB | ||
---------- Request ---------- | ||
---------- Response ---------- | ||
{ | ||
"field": "value" | ||
}""" | ||
|
||
val expectedHttpPostTransaction = | ||
"""URL: http://localhost/getUsers | ||
Method: POST | ||
Protocol: HTTP | ||
Status: Complete | ||
Response: 200 OK | ||
SSL: No | ||
Request time: ${Date(1300000)} | ||
Response time: ${Date(1300300)} | ||
Duration: 1000 ms | ||
Request size: 1.0 kB | ||
Response size: 1.0 kB | ||
Total size: 2.0 kB | ||
---------- Request ---------- | ||
---------- Response ---------- | ||
{ | ||
"field": "value" | ||
}""" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters