Giter Club home page Giter Club logo

Comments (5)

lilgallon avatar lilgallon commented on June 16, 2024

Thank you for your report, we have been using EVSE patches in our plateform without any issues. I will take a look into it

from ocpi-toolkit.

lilgallon avatar lilgallon commented on June 16, 2024

I wrote this test:

class MapperTests {

    @Test
    fun shouldProperlyMap() {
        expectThat(
            mapper.readValue<LocationPartial>(
                """{
                "name": "Interparking Gent Zuid",
                "last_updated": "2019-06-24T12:39:09Z"
                }
            """.trimIndent()
            )
        ).isA<LocationPartial>()

        expectThat(
            mapper.readValue<LocationPartial>(
                "{\n\"name\": \"Interparking Gent Zuid\",\n\"last_updated\": \"2019-06-24T12:39:09Z\"\n}"
            )
        ).isA<LocationPartial>()
    }
}

And it works. Have you got more details to share?

from ocpi-toolkit.

andacata avatar andacata commented on June 16, 2024

Maybe I'm doing something wrong, but I can't get your test to work 🤔

package com.izivia.ocpi.toolkit.common

import com.izivia.ocpi.toolkit.modules.locations.domain.LocationPartial
import org.junit.jupiter.api.Test
import strikt.api.expectThat

class MapperTest {

    @Test
    fun shouldProperlyMap() {
        expectThat(
            mapper.readValue<LocationPartial>(
                """{
                "name": "Interparking Gent Zuid",
                "last_updated": "2019-06-24T12:39:09Z"
                }
            """.trimIndent()
            )
        ).isA<LocationPartial>()

        expectThat(
            mapper.readValue<LocationPartial>(
                "{\n\"name\": \"Interparking Gent Zuid\",\n\"last_updated\": \"2019-06-24T12:39:09Z\"\n}"
            )
        ).isA<LocationPartial>()
    }
}

is generating the following error:

e: file:///home/.../ocpi-toolkit/ocpi-toolkit-2.2.1/src/test/kotlin/com/izivia/ocpi/toolkit/common/MapperTest.kt:22:20 None of the following functions can be called with the arguments supplied: 
public final fun <T : Any!> readValue(p0: JsonParser!, p1: ResolvedType!): TypeVariable(T)! defined in com.fasterxml.jackson.databind.ObjectMapper
public open fun <T : Any!> readValue(p0: JsonParser!, p1: TypeReference<TypeVariable(T)!>!): TypeVariable(T)! defined in com.fasterxml.jackson.databind.ObjectMapper
public open fun <T : Any!> readValue(p0: JsonParser!, p1: JavaType!): TypeVariable(T)! defined in com.fasterxml.jackson.databind.ObjectMapper
public open fun <T : Any!> readValue(p0: JsonParser!, p1: Class<TypeVariable(T)!>!): TypeVariable(T)! defined in com.fasterxml.jackson.databind.ObjectMapper
public open fun <T : Any!> readValue(p0: DataInput!, p1: JavaType!): TypeVariable(T)! defined in com.fasterxml.jackson.databind.ObjectMapper
public open fun <T : Any!> readValue(p0: DataInput!, p1: Class<TypeVariable(T)!>!): TypeVariable(T)! defined in com.fasterxml.jackson.databind.ObjectMapper
public open fun <T : Any!> readValue(p0: File!, p1: TypeReference<TypeVariable(T)!>!): TypeVariable(T)! defined in com.fasterxml.jackson.databind.ObjectMapper
public open fun <T : Any!> readValue(p0: File!, p1: JavaType!): TypeVariable(T)! defined in com.fasterxml.jackson.databind.ObjectMapper
...

from ocpi-toolkit.

andacata avatar andacata commented on June 16, 2024

The exception is thrown in this line:

location = mapper.readValue(req.body!!, LocationPartial::class.java)

from ocpi-toolkit.

andacata avatar andacata commented on June 16, 2024

Forget it. In my test I was JSON encoding a JSON encoded string before doing the real call to the server 🤦‍♂️

Sorry for that, and thanks for your time.

from ocpi-toolkit.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.