diff --git a/build.gradle b/build.gradle index c0d59eeb..85db2687 100644 --- a/build.gradle +++ b/build.gradle @@ -12,20 +12,19 @@ buildscript { } plugins { - id 'com.gradle.build-scan' version '1.11' id "com.jfrog.bintray" version "1.8.0" id "org.sonarqube" version "2.6.1" - id 'org.unbroken-dome.test-sets' version '1.4.2' + id 'org.unbroken-dome.test-sets' version '2.2.1' id "info.solidsoft.pitest" version "1.2.4" } ext { JUNIT_JUPITER_VERSION = "5.0.2" JUNIT_PLATFORM_VERSION = "1.0.2" - MOCKITO_VERSION = "2.12.0" + MOCKITO_VERSION = "3.2.4" POWER_MOCK_UTILS_VERSION = "1.6.6" ASSERTJ_CORE_VERSION = "3.8.0" - JACOCO_VERSION = "0.7.9" + JACOCO_VERSION = "0.8.5" } apply plugin: 'java' @@ -34,12 +33,6 @@ apply plugin: 'jacoco' apply plugin: 'org.junit.platform.gradle.plugin' apply plugin: 'maven-publish' -buildScan { - licenseAgreementUrl = 'https://gradle.com/terms-of-service' - licenseAgree = 'yes' - publishAlways() -} - repositories { mavenCentral() jcenter() @@ -83,12 +76,13 @@ junitPlatform { dependencies { compile("org.slf4j:slf4j-api:1.7.25") - compile("org.apache.commons:commons-lang3:3.7") + compile("org.apache.commons:commons-lang3:3.9") compile("org.apache.commons:commons-collections4:4.1") compile("com.googlecode.combinatoricslib:combinatoricslib:2.1") - compile("org.javassist:javassist:3.22.0-GA") + compile("org.javassist:javassist:3.26.0-GA") + compileOnly('org.projectlombok:lombok:1.18.12') + annotationProcessor('org.projectlombok:lombok:1.18.12') - testCompile("org.projectlombok:lombok:1.16.18") testCompile("org.junit.jupiter:junit-jupiter-api:${JUNIT_JUPITER_VERSION}") { changing = true } testRuntime("org.junit.jupiter:junit-jupiter-engine:${JUNIT_JUPITER_VERSION}") { changing = true } testCompile("org.junit.platform:junit-platform-runner:${JUNIT_PLATFORM_VERSION}") { changing = true } @@ -96,6 +90,8 @@ dependencies { testCompile("org.mockito:mockito-core:${MOCKITO_VERSION}") testCompile("org.powermock.tests:powermock-tests-utils:${POWER_MOCK_UTILS_VERSION}") testCompileOnly("org.apiguardian:apiguardian-api:1.0.0") + testCompileOnly('org.projectlombok:lombok:1.18.12') + testAnnotationProcessor('org.projectlombok:lombok:1.18.12') } afterEvaluate { @@ -108,8 +104,6 @@ afterEvaluate { task junit5CodeCoverageReport(type: JacocoReport) { executionData junitPlatformTest sourceSets sourceSets.main - sourceDirectories = files(project.sourceSets.main.allSource.srcDirs) - classDirectories = files(project.sourceSets.main.output) reports { xml.enabled = false html.destination file("${buildDir}/reports/jacoco/html") @@ -125,10 +119,6 @@ pitest { outputFormats = ['XML', 'HTML'] } -task wrapper(type: Wrapper) { - gradleVersion = '4.4' -} - def pomConfig = { licenses { license { diff --git a/gradle.properties b/gradle.properties index b1b401b4..c03ceef2 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,4 +1,4 @@ group=pl.pojo artifact=pojo-tester version=0.8.0-SNAPSHOT -sourceCompatibility=1.8 +sourceCompatibility=13 diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 24d4e9cf..758de960 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 253af5da..a2bf1313 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,5 @@ -#Sun Dec 17 10:43:20 CET 2017 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-6.2.2-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip diff --git a/gradlew b/gradlew index 4453ccea..cccdd3d5 100755 --- a/gradlew +++ b/gradlew @@ -33,11 +33,11 @@ DEFAULT_JVM_OPTS="" # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD="maximum" -warn ( ) { +warn () { echo "$*" } -die ( ) { +die () { echo echo "$*" echo @@ -155,7 +155,7 @@ if $cygwin ; then fi # Escape application args -save ( ) { +save () { for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done echo " " } diff --git a/gradlew.bat b/gradlew.bat index f9553162..e95643d6 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -1,84 +1,84 @@ -@if "%DEBUG%" == "" @echo off -@rem ########################################################################## -@rem -@rem Gradle startup script for Windows -@rem -@rem ########################################################################## - -@rem Set local scope for the variables with windows NT shell -if "%OS%"=="Windows_NT" setlocal - -set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. -set APP_BASE_NAME=%~n0 -set APP_HOME=%DIRNAME% - -@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS= - -@rem Find java.exe -if defined JAVA_HOME goto findJavaFromJavaHome - -set JAVA_EXE=java.exe -%JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto init - -echo. -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:findJavaFromJavaHome -set JAVA_HOME=%JAVA_HOME:"=% -set JAVA_EXE=%JAVA_HOME%/bin/java.exe - -if exist "%JAVA_EXE%" goto init - -echo. -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:init -@rem Get command-line arguments, handling Windows variants - -if not "%OS%" == "Windows_NT" goto win9xME_args - -:win9xME_args -@rem Slurp the command line arguments. -set CMD_LINE_ARGS= -set _SKIP=2 - -:win9xME_args_slurp -if "x%~1" == "x" goto execute - -set CMD_LINE_ARGS=%* - -:execute -@rem Setup the command line - -set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar - -@rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% - -:end -@rem End local scope for the variables with windows NT shell -if "%ERRORLEVEL%"=="0" goto mainEnd - -:fail -rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of -rem the _cmd.exe /c_ return code! -if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 -exit /b 1 - -:mainEnd -if "%OS%"=="Windows_NT" endlocal - -:omega +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS= + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto init + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto init + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:init +@rem Get command-line arguments, handling Windows variants + +if not "%OS%" == "Windows_NT" goto win9xME_args + +:win9xME_args +@rem Slurp the command line arguments. +set CMD_LINE_ARGS= +set _SKIP=2 + +:win9xME_args_slurp +if "x%~1" == "x" goto execute + +set CMD_LINE_ARGS=%* + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/settings.gradle b/settings.gradle index 4ed867cf..e0e3058a 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1 +1,15 @@ -rootProject.name = 'pojo-tester' +buildscript { + rootProject.name = 'pojo-tester' +} + +plugins { + id "com.gradle.enterprise" version "3.1.1" +} + +gradleEnterprise { + buildScan { + termsOfServiceUrl = 'https://gradle.com/terms-of-service' + termsOfServiceAgree = 'yes' + publishAlways() + } +} \ No newline at end of file diff --git a/src/main/java/pl/pojo/tester/internal/utils/FieldUtils.java b/src/main/java/pl/pojo/tester/internal/utils/FieldUtils.java index f2b291ba..1bd6fb47 100644 --- a/src/main/java/pl/pojo/tester/internal/utils/FieldUtils.java +++ b/src/main/java/pl/pojo/tester/internal/utils/FieldUtils.java @@ -84,17 +84,7 @@ public static List getSpecifiedFields(final Class clazz, final List clazz = field.getClass(); - try { - field.setAccessible(true); - final Field modifierField = clazz.getDeclaredField(MODIFIERS_FIELD_NAME_IN_FIELD_CLASS); - modifierField.setAccessible(true); - - final int modifiers = field.getModifiers() & ~Modifier.FINAL; - modifierField.setInt(field, modifiers); - } catch (IllegalAccessException | NoSuchFieldException e) { - throw new GetOrSetValueException(MODIFIERS_FIELD_NAME_IN_FIELD_CLASS, clazz, e); - } + field.setAccessible(true); } private static boolean excludeEmptySet(final List fields) { diff --git a/src/test/java/pl/pojo/tester/internal/field/primitive/AbstractPrimitiveValueChangerTest.java b/src/test/java/pl/pojo/tester/internal/field/primitive/AbstractPrimitiveValueChangerTest.java index fea70ca1..16430ad3 100644 --- a/src/test/java/pl/pojo/tester/internal/field/primitive/AbstractPrimitiveValueChangerTest.java +++ b/src/test/java/pl/pojo/tester/internal/field/primitive/AbstractPrimitiveValueChangerTest.java @@ -13,7 +13,7 @@ class AbstractPrimitiveValueChangerTest { @Test void Should_Return_False_When_Field_Is_Not_Primitive() throws Exception { // given - final Field field = Thread.class.getDeclaredField("threadQ"); + final Field field = Thread.class.getDeclaredField("name"); final AbstractPrimitiveValueChanger changerMock = new ImplementationForTest(); // when