Skip to content

Commit c4ed3cb

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

6 files changed

Lines changed: 5 additions & 60 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 & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616

1717
package com.wultra.android.powerauth.networking
1818

19-
import android.util.Log
2019
import androidx.test.ext.junit.runners.AndroidJUnit4
2120
import androidx.test.platform.app.InstrumentationRegistry
2221
import com.wultra.android.powerauth.networking.data.BaseRequest
@@ -33,6 +32,7 @@ import io.getlime.security.powerauth.sdk.PowerAuthAuthentication
3332
import okhttp3.OkHttpClient
3433
import org.junit.Assert.assertEquals
3534
import org.junit.Assert.assertNotNull
35+
import org.junit.Assert.assertNull
3636
import org.junit.Assert.assertTrue
3737
import org.junit.Assert.fail
3838
import org.junit.Assume.assumeNotNull
@@ -47,16 +47,14 @@ import java.util.concurrent.TimeUnit
4747
*
4848
* These tests require a valid `config.json` in the androidTest assets
4949
* and a running PowerAuth server. Tests are skipped when the config is absent.
50-
*
51-
* Mirrors Apple's WPNPostIntegrationTests (success + failure suites).
5250
*/
5351
@RunWith(AndroidJUnit4::class)
5452
class PostRealServerTest {
5553

5654
private fun loadConfigOrSkip(): TestConfiguration {
5755
val context = InstrumentationRegistry.getInstrumentation().targetContext
5856
val config = TestConfiguration.load(context)
59-
assumeNotNull("Skipping: config.json not found in test assets", config)
57+
assumeNotNull("\uFE0F Skipping: config.json not found in test assets", config)
6058
return config!!
6159
}
6260

@@ -65,9 +63,6 @@ class PostRealServerTest {
6563
/**
6664
* Plain POST to jsonplaceholder.typicode.com.
6765
*
68-
* Mirrors Apple's `plainPost()` test. Verifies that the HTTP transport
69-
* layer works correctly by making a real network call.
70-
*
7166
* The test expects an error because jsonplaceholder does not return
7267
* the WPN envelope format (`{"status":"OK", ...}`).
7368
*/
@@ -106,32 +101,15 @@ class PostRealServerTest {
106101

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

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-
}
104+
assertNull("Response should be null because JSONPlaceholder response does not match StatusResponse", receivedResponse?.status)
105+
106+
assertNull("Request should not fail on transport level", receivedError)
128107
}
129108

130109
// --- Success tests (require config.json) ---
131110

132111
/**
133112
* E2EE POST with application scope encryption.
134-
* Mirrors Apple's `e2eePost()` test.
135113
*/
136114
@Test
137115
fun e2eePost() {
@@ -178,7 +156,6 @@ class PostRealServerTest {
178156

179157
/**
180158
* Signed POST with PowerAuth signature.
181-
* Mirrors Apple's `signedPost()` test.
182159
*/
183160
@Test
184161
fun signedPost() {
@@ -267,7 +244,6 @@ class PostRealServerTest {
267244

268245
/**
269246
* E2EE POST with activation scope without activation.
270-
* Mirrors Apple's `e2eePostUnactivated()` test.
271247
*/
272248
@Test
273249
fun e2eePostUnactivated() {
@@ -308,7 +284,6 @@ class PostRealServerTest {
308284

309285
/**
310286
* Signed POST with wrong PIN.
311-
* Mirrors Apple's `signedPostWrongPin()` test.
312287
*/
313288
@Test
314289
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)