Git Product home page Git Product logo

Comments (6)

nymanjens avatar nymanjens commented on April 29, 2024 1

Would you mind adding a hint in the changelog as this is a "breaking" behavior change (depending on usage of course).

Done in cd15758

from testparameterinjector.

nymanjens avatar nymanjens commented on April 29, 2024

Hi!

Thanks for letting me know.

The behavior you are seeing surprises me, because we have a unit test since 2020-08-05 that tests that

    @Test
    public void withFloat(@TestParameter({"1.2", "2"}) float param) {
      testNameToParameterMap.put(testName.getMethodName(), param);
    }

gets the test name

"withFloat[param=2.0]"

which seems to match your use case.

(I can't link to the test because it is removed when exporting to Github due to a dependency on textproto parsing)

I suspect this may be a combination of a change in TestParameterInjector and your JVM being different (e.g. Anroid vs openJDK).

from testparameterinjector.

nymanjens avatar nymanjens commented on April 29, 2024

Hmm, scrap that. Even before this library was open sourced, we had a unit test that ran on an Android emulator that checks that @TestParameter({"1.2", "2"}) float param) gives "withFloat[param=2.0]".

Since May 2022, we extended this test with multiple Android versions, starting at SDK version 15.

So that's probably not it either.

from testparameterinjector.

nymanjens avatar nymanjens commented on April 29, 2024

it's very likely that this had an unintended behavior change:
e390bab#diff-f0f3c84fc90c4da3bd5e1267e7b74d5774029389e86dfe1bba895740b8b886d0R142

(just reading this now)

It feels like it can't be a coincidence, I agree.

In your case, since parameter names are not present and the value is not an array, it should change value() to valueAsString(), which in turn becomes String.valueOf(value());.

So then String.valueOf(value()) should give a different result as MessageFormat.format("{0}", value()).

From the documentation of MessageFormat, it seems like it uses something like NumberFormat.getInstance(getLocale()).format(argument) to format the float. That could explain why you are seeing a different result than the Google test infrastructure.

If that's the case, I'd argue this is actually an improvement because it makes the result independent of the locale.

from testparameterinjector.

TWiStErRob avatar TWiStErRob commented on April 29, 2024

Ok, I'd say fair evaluation, nice! :)
Would you mind adding a hint in the changelog as this is a "breaking" behavior change (depending on usage of course).

from testparameterinjector.

TWiStErRob avatar TWiStErRob commented on April 29, 2024

Oh, btw my execution is on JVM, not Android devices. Paparazzi is amazing tech!

from testparameterinjector.

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.