stleary / JSON-Java-unit-test

Junit test harness to validate the JSON-Java GitHub project code.
Apache License 2.0
28 stars 45 forks source link

IntegrateUnitTests into douglascrockford/JSON-java #20

Closed mdaehnert closed 9 years ago

mdaehnert commented 9 years ago

Is it possible to integrate these tests directly into code-repository douglascrockford/JSON-java? The positive argument would be, that tests are directly next to code.

Feedback welcome.

mdaehnert commented 9 years ago

Found this discussion about UnitTests: https://github.com/douglascrockford/JSON-java/pull/133#issuecomment-112720646 Unfortunately without argumentation of externalized UnitTests / not used maven-structure.

Maybe we can solve two disadvantages with one task:

Can you please give further information on that?

I would be glad to help if you want to integrate these two tasks.

stleary commented 9 years ago

Early on, unit tests were integrated into the JSON-java project, but apparently there were implementation problems and the tests were eventually removed. Integrating the unit tests has advantages and disadvantages. At this time I think it is sufficient to document the existence of the tests in the readme, which I did today, thanks for the suggestion.

There have been numerous requests to mavenize, or otherwise add project support. To date, all have been declined. I am interested in providing Maven and Gradle support, but have to address a learning curve first and also get approval to proceed. I expect it will be a one-off using a separate project, like the current unit tests. So, if you are interested in working on it, please stay tuned, your help would be appreciated.

stleary commented 9 years ago

Posting this project to the Maven central repository as an exercise, to work through the issues JSON-java will face. Created release v1.0.0 for the latest code, but will need another release that is compatible with the latest JSON-java maven release.

Maven does not allow random projects to add themselves to the repository. They recommend using Sonatype as a provider, so I signed up an opened a JIRA case as advised. JSON-java currently uses this provider. The groupId is com.github.stleary.

I am not going to change the existing file paths, so the local maven repository will be hand crafted.

A pom.xml will be created that will look something like this (Does not have sonatype specific entries yet, and the earlier release which is not yet created will be specified):

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/
2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/
xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>

  <groupId>com.github.stleary</groupId>
  <artifactId>JsonJavaJunit</artifactId>
  <version>v1.0.0</version>
  <packaging>jar</packaging>

  <name>json</name>
  <url>http://maven.apache.org</url>

  <properties>
    <maven.compiler.source>1.8</maven.compiler.source>
    <maven.compiler.target>1.8</maven.compiler.target>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
  </properties>

  <dependencies>
  <dependency>
    <groupId>org.json</groupId>
    <artifactId>json</artifactId>
    <version>20141113</version>
  </dependency>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>4.12</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.mockito</groupId>
      <artifactId>mockito-all</artifactId>
      <version>1.9.5</version>
    </dependency>
  </dependencies>
</project>

A pgp signature is required for the artifacts. My public key can be accessed by searching for stleary AT gmail DOT com.

stleary commented 9 years ago

No plans to integrate unit tests into JSON-java at this time. May take this up again in the future.