Skip to content

Commit 25589c8

Browse files
committed
remove redundand test and comments
1 parent ed007b1 commit 25589c8

6 files changed

Lines changed: 5 additions & 59 deletions

File tree

library/src/androidTest/java/com/wultra/android/powerauth/networking/PostMockWebServerTest.kt

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -237,32 +237,6 @@ class PostMockWebServerTest {
237237
assertEquals("{}", body) // BaseRequest serializes to empty JSON object
238238
}
239239

240-
@Test
241-
fun basicPostUrlConstruction() {
242-
server.enqueue(
243-
MockResponse()
244-
.setResponseCode(200)
245-
.setBody("""{"status":"OK"}""")
246-
)
247-
248-
val latch = CountDownLatch(1)
249-
250-
api.post(
251-
data = BaseRequest(),
252-
endpoint = EndpointBasic<BaseRequest, StatusResponse>("/v1/my/endpoint"),
253-
listener = object : IApiCallResponseListener<StatusResponse> {
254-
override fun onSuccess(result: StatusResponse) { latch.countDown() }
255-
override fun onFailure(error: ApiError) { latch.countDown() }
256-
}
257-
)
258-
259-
assertTrue(latch.await(10, TimeUnit.SECONDS))
260-
261-
val recorded = server.takeRequest(1, TimeUnit.SECONDS)
262-
assertNotNull(recorded)
263-
assertEquals("/v1/my/endpoint", recorded!!.path)
264-
}
265-
266240
// --- Failure tests ---
267241

268242
@Test

library/src/androidTest/java/com/wultra/android/powerauth/networking/PostRealServerTest.kt

Lines changed: 5 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ import io.getlime.security.powerauth.sdk.PowerAuthAuthentication
3333
import okhttp3.OkHttpClient
3434
import org.junit.Assert.assertEquals
3535
import org.junit.Assert.assertNotNull
36+
import org.junit.Assert.assertNull
3637
import org.junit.Assert.assertTrue
3738
import org.junit.Assert.fail
3839
import org.junit.Assume.assumeNotNull
@@ -47,16 +48,14 @@ import java.util.concurrent.TimeUnit
4748
*
4849
* These tests require a valid `config.json` in the androidTest assets
4950
* and a running PowerAuth server. Tests are skipped when the config is absent.
50-
*
51-
* Mirrors Apple's WPNPostIntegrationTests (success + failure suites).
5251
*/
5352
@RunWith(AndroidJUnit4::class)
5453
class PostRealServerTest {
5554

5655
private fun loadConfigOrSkip(): TestConfiguration {
5756
val context = InstrumentationRegistry.getInstrumentation().targetContext
5857
val config = TestConfiguration.load(context)
59-
assumeNotNull("Skipping: config.json not found in test assets", config)
58+
assumeNotNull("\uFE0F Skipping: config.json not found in test assets", config)
6059
return config!!
6160
}
6261

@@ -65,9 +64,6 @@ class PostRealServerTest {
6564
/**
6665
* Plain POST to jsonplaceholder.typicode.com.
6766
*
68-
* Mirrors Apple's `plainPost()` test. Verifies that the HTTP transport
69-
* layer works correctly by making a real network call.
70-
*
7167
* The test expects an error because jsonplaceholder does not return
7268
* the WPN envelope format (`{"status":"OK", ...}`).
7369
*/
@@ -106,32 +102,15 @@ class PostRealServerTest {
106102

107103
assertTrue("Real network request should complete within 30s", latch.await(30, TimeUnit.SECONDS))
108104

109-
// jsonplaceholder returns 201 for POST /posts, but the body is not
110-
// in WPN envelope format. The library should either:
111-
// 1. Parse successfully (if the response happens to parse as StatusResponse)
112-
// 2. Fail with a parse error (ApiHttpException wrapping a Gson error)
113-
//
114-
// The key assertion is that the request was actually sent and we got a response.
115-
if (receivedError != null) {
116-
// Expected: transport succeeded but response format doesn't match
117-
Log.d("PostRealServerTest", "Got expected error: ${receivedError!!.e}")
118-
val httpException = receivedError!!.e as? ApiHttpException
119-
if (httpException != null) {
120-
// If it's an HTTP exception, the status code should be 201 (Created)
121-
assertEquals(201, httpException.code)
122-
}
123-
// Otherwise it's a parse error, which is also acceptable
124-
} else {
125-
// If parsing somehow succeeded, the status might be null/unexpected
126-
Log.d("PostRealServerTest", "Got response: ${receivedResponse?.status}")
127-
}
105+
assertNull("Response should be null because JSONPlaceholder response does not match StatusResponse", receivedResponse?.status)
106+
107+
assertNull("Request should not fail on transport level", receivedError)
128108
}
129109

130110
// --- Success tests (require config.json) ---
131111

132112
/**
133113
* E2EE POST with application scope encryption.
134-
* Mirrors Apple's `e2eePost()` test.
135114
*/
136115
@Test
137116
fun e2eePost() {
@@ -178,7 +157,6 @@ class PostRealServerTest {
178157

179158
/**
180159
* Signed POST with PowerAuth signature.
181-
* Mirrors Apple's `signedPost()` test.
182160
*/
183161
@Test
184162
fun signedPost() {
@@ -267,7 +245,6 @@ class PostRealServerTest {
267245

268246
/**
269247
* E2EE POST with activation scope without activation.
270-
* Mirrors Apple's `e2eePostUnactivated()` test.
271248
*/
272249
@Test
273250
fun e2eePostUnactivated() {
@@ -308,7 +285,6 @@ class PostRealServerTest {
308285

309286
/**
310287
* Signed POST with wrong PIN.
311-
* Mirrors Apple's `signedPostWrongPin()` test.
312288
*/
313289
@Test
314290
fun signedPostWrongPin() {

library/src/test/java/com/wultra/android/powerauth/networking/BaseNetworkingObjectsTest.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ import org.junit.Test
3131

3232
/**
3333
* Tests Gson serialization/deserialization of request and response models.
34-
* Mirrors Apple's WPNBaseNetworkingObjectsTests.
3534
*/
3635
class BaseNetworkingObjectsTest {
3736

library/src/test/java/com/wultra/android/powerauth/networking/GsonConverterTest.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ import org.junit.Test
3737

3838
/**
3939
* Tests for GsonRequestBodyBytes and GsonResponseBodyConverter.
40-
* Mirrors Apple's WPNHttpRequestTests for request/response processing.
4140
*/
4241
class GsonConverterTest {
4342

library/src/test/java/com/wultra/android/powerauth/networking/SSLValidationStrategyTest.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ import org.junit.Test
2323

2424
/**
2525
* Tests for SSLValidationStrategy.
26-
* Mirrors Apple's WPNSSLValidationStrategyTests.
2726
*
2827
* Note: noValidation() and sslPinning() depend on PowerAuth SDK classes
2928
* and are tested in instrumented tests instead.

library/src/test/java/com/wultra/android/powerauth/networking/UserAgentTest.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ import org.junit.Test
2222

2323
/**
2424
* Tests for UserAgent factory methods.
25-
* Mirrors Apple's WPNUserAgentTests.
2625
*
2726
* Note: UserAgent.libraryDefault(context) requires Android Context
2827
* and is tested in instrumented tests instead.

0 commit comments

Comments
 (0)