Coder Social home page Coder Social logo

unit-tck's People

Contributors

daniel-dos avatar desruisseaux avatar eralmas7 avatar keilw avatar teobais avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

unit-tck's Issues

Update dependencies and POMs

Update dependencies like lib and RI to the latest version. Also update parent POM to the latest version before releasing 1.0.1

Replace Group enum with string constants

As the groups property of the @test annotation expects a String array and does not work with enum values, it is best to give up the Group enum and use those string constants directly.

The Profile enum shall remain because it is used in a different place.

TCK should not depend on Indriya

Executing mvn dependency:tree on the TCK gives the following output:

tech.units:unit-tck:bundle:2.1.2-SNAPSHOT
+- javax.measure:unit-api:jar:2.1.2:compile
+- tech.units:indriya:jar:2.1.2:compile
|  +- tech.uom.lib:uom-lib-common:jar:2.1:compile
(…snip…)

This is an issue when we want to test any implementation other than Indriya, because the ServiceLoader used by the TCK can randomly pickup Indriya instead of the implementation that we want to test. It has happened to me today when trying to run Seshat tests. I got confusing test failures until I understood that tests specifically designed for Seshat were running with Indriya implementation.

As a workaround, importing the TCK in a project as below seems to work:

    <dependency>
      <groupId>tech.units</groupId>
      <artifactId>unit-tck</artifactId>
      <version>2.1.1</version>
      <scope>test</scope>
      <exclusions>
        <exclusion>     <!-- Avoid possible interference with the implementation under test -->
          <groupId>tech.units</groupId>
          <artifactId>indriya</artifactId>
        </exclusion>
        <exclusion>     <!-- MutabilityDetector uses an older version than the one inherited from JUnit. -->
          <groupId>org.hamcrest</groupId>
          <artifactId>hamcrest-core</artifactId>
        </exclusion>
      </exclusions>
    </dependency>
    <dependency>
      <groupId>tech.uom.lib</groupId>
      <artifactId>uom-lib-common</artifactId>     <!-- Was a transitive dependency of excluded Indriya. -->
      <version>2.1</version>
      <scope>test</scope>
    </dependency>

But if excluding Indriya does not prevent the tests to work, why the TCK depends on Indriya? If this is used for testing the tests, then could the Indriya dependency be declared with <scope>test</scope> in the TCK project? It would make much simpler to import the TCK in another project.

JavaDoc in QuantityTypesTest

The QuantityTypesTest class has some JavaDoc that seems copied from another class. It should be changed to what each method does.

Consider dealing with JPMS build like API

While the current approach in the POM to JPMS works, the module-info is placed in the (Java 8 backward compatible) default module. This confuses the compiler and breaks the build if the TCK is run with Java 8:

[INFO] �[1m------------------------------------------------------------------------�[m
[INFO] �[1;31mBUILD FAILURE�[m
[INFO] �[1m------------------------------------------------------------------------�[m
[INFO] Total time:  2.735 s
[INFO] Finished at: 2023-10-04T23:46:15+02:00
[INFO] �[1m------------------------------------------------------------------------�[m
[ERROR] Failed to execute goal �[32morg.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile�[m �[1m(default-compile)�[m on project �[36munit-tck-usage-java8�[m: �[1;31mFatal error compiling�[m: invalid flag: --release -> �[1m[Help 1]

If Java 9 or above are used, it works fine.

For API or Indriya RI, the module-info is located in META-INF/versions/9 and higher, so the default JDK won't pick them up if it is Java 8. This should be possible with the AntRun plugin, as that is easier than the ToolChain plugin used by the RI.

MR2 could be the last version to still support Java 8, but with the new SI prefixes and Java 8 still around till at least 2030, the current MR still supports it as the minimal Java version.

Reduce JavaDoc warnings/errors

Building the TCK when JavaDoc is generated there are several warnings or errors. None break the build but adding necessary tags or information as well as changing some links or tags this can be improved and the number of warnings or errors reduced to a minimum.

Make getPrefixClasses in ServiceConfiguration default

While it should be possible to override ServiceConfiguration.getPrefixClasses, a vast majority of implementations may be happy with the two built-in prefixes of the API, therefore ServiceConfiguration should get a default method,

Add module-info to TCK

Allowing to configure the TCK test suite via ServiceConfiguration in a module-info instead of META-INF:

module com.service.provider {
    requires tech.units.tck;
    provides tech.units.tck.util.ServiceConfiguration with com.service.provider.MyServiceConfig;
}

Include information about the JDK

Include information about the JDK that's used to run the TCK, as the Java versions change massively and it is also interesting to know, which OpenJDK distribution was used where the information is available.

Minor refinements in test documentation

There could be some minor refinements in test documentation, e.g.
"Test method: 4.2.1.2.1 Ensure the divide() operation is implemented."
might say
"Test method: 4.2.1.2.1 Ensure the divide(Unit) operation is implemented."
instead, to align with other method tests.

Update to Jakarta Inject

Update from the old Injection JSR to Jakarta Inject, 1.0 or better 2.0

jakarta.inject jakarta.inject-api 2.0.0

Add further TCK tests for Prefix

The FundamentalTypesTest already checks for prefixes,

The test description

Ensure at least one Prefix implementation is available/registered.

Should be refined, because the API already contains the two most common Prefix implementations.
In addition to rephrasing it as "at least two" we may consider a type-check that MetricPrefix and BinaryPrefix are always part of that list.

In the ServicesTest for SystemOfUnitsService the method returning a Set of Prefix may also check, that MetricPrefix and BinaryPrefix are always part of the Set. And the minimum size is 2.

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.