Update builds to support strictMode testing

Abierto
#953 3 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
5/5
Tiempo estimado
Más de una semana
Aptitud para principiantes
20/100
Tipo de issue
Nueva funcionalidad
Claridad
Necesita aclaración
Estado de actividad
Estancado
Stack tecnológico
java

Línea de trabajo

Start by locating the Gradle and Maven build files and their existing test tasks, then determine how strictMode is configured and how the tests should be run twice. The issue does not name files or provide a verified implementation; completion requires a confirmed approach that works in both builds and passes the full test suite.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

In progress

After executing the unit tests, set default strictMode to true, then re-run all of the tests.
Fix in both gradle and maven builds. It might be possible (?) to integrate this action into the existing test task, but if not:

In Gradle:
Modify the existing test task (copilot, I have not verified this):

apply plugin: 'java'

repositories {
    mavenCentral()
}

dependencies {
    testImplementation 'junit:junit:4.12'
}

task modifyCode {
    doLast {
        // Add your code modification logic here
        def file = file('src/main/java/com/example/YourClass.java')
        def text = file.text
        text = text.replaceAll('oldCode', 'newCode')
        file.text = text
        println 'Code modified.'
    }
}

task rerunTests(dependsOn: ['modifyCode', 'test']) {
    doLast {
        println 'Re-running tests...'
    }
}

test {
    finalizedBy 'rerunTests'
}

If a new task is needed (claude.ai, not verified):

    dependsOn test
    doLast {
        // Make your code change here
        File sourceFile = file('src/main/java/YourFile.java')
        String content = sourceFile.text
        content = content.replace('oldCode', 'newCode')
        sourceFile.text = content
        
        // Run tests again
        tasks.test.execute()
    }
}

Copilot also suggests a one-test-run fix for maven, but it requires a new ModifyCode class. Not shown here.

In Maven, new task (claude.ai, not verified):

<plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>exec-maven-plugin</artifactId>
    <version>3.1.0</version>
    <executions>
        <execution>
            <id>test-with-code-change</id>
            <phase>verify</phase>
            <goals>
                <goal>java</goal>
            </goals>
            <configuration>
                <mainClass>org.apache.maven.shared.utils.io.FileUtils</mainClass>
                <arguments>
                    <argument>src/main/java/YourFile.java</argument>
                    <argument>oldCode</argument>
                    <argument>newCode</argument>
                </arguments>
            </configuration>
        </execution>
    </executions>
</plugin>
Lenguaje dominante
Java
Estrellas
4.7k
Forks
2.6k
Merge medio
11 d 18 min
PR fusionados (30 d)
1

Guía de contribución

Abrir la guía de contribución

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de stleary/JSON-java

Todos los issues de stleary/JSON-java

Issues similares

Más issues de Java

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.