Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UserStorage is not filled in the internal constructor of AogRequest #33

Open
zonder129 opened this issue Sep 15, 2019 · 0 comments
Open

Comments

@zonder129
Copy link

For example in MockRequestBuilder a build() method sets user field of appRequest and creates aogRequest out of it:

...
if (userStorage != null) {
    user.userStorage = gson.toJson(userStorage)
}
appRequest.user = user
...
val aogRequest = AogRequest(appRequest)
...

But inside internal constructor of AogRequest userStorage field is not set at all, only user.userStorage does:

internal class AogRequest internal constructor(
        override val appRequest: AppRequest) : ActionRequest {
    ...
    override var userStorage: MutableMap<String, Any> = HashMap()
    ...
    override val user: User? get() = appRequest.user
    ...
}

So, if we try in a test to set this userStorage, the field will be empty:

@Test
fun userStorageTest() {
    val actionRequest = MockRequestBuilder()
        .setUserStorage(mapOf(Pair("userId", "someId")))
        .build()
    println("userStorage = ${actionRequest.userStorage}")
    println("user.userStorage = ${actionRequest.user?.userStorage}")
}

the output will be:

userStorage = {}
user.userStorage = {"userId":"someId"}
@zonder129 zonder129 changed the title UserStorage is not filled in internal constructor of AogRequest UserStorage is not filled in the internal constructor of AogRequest Sep 15, 2019
@atulep atulep assigned atulep and unassigned taycaldwell Sep 23, 2019
@atulep atulep removed their assignment Jun 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants