nebius/SWE-rebench-V2-PRs huggingface dataset:
Repository: jhipster/jhipster-lite
Pull request #9727 (2024-05-03 19:19:25)

Init proto.lock file for protobuf-backwards-compatibility-check module
This avoids having this file not committed after the first build


Patch:
diff --git a/src/main/java/tech/jhipster/lite/generator/server/javatool/protobuf/domain/ProtobufModuleFactory.java b/src/main/java/tech/jhipster/lite/generator/server/javatool/protobuf/domain/ProtobufModuleFactory.java
index d8052c1b2..b96eced6c 100644
--- a/src/main/java/tech/jhipster/lite/generator/server/javatool/protobuf/domain/ProtobufModuleFactory.java
+++ b/src/main/java/tech/jhipster/lite/generator/server/javatool/protobuf/domain/ProtobufModuleFactory.java
@@ -99,6 +99,9 @@ public class ProtobufModuleFactory {
   public JHipsterModule buildProtobufBackwardsCompatibilityCheckModule(JHipsterModuleProperties properties) {
     //@formatter:off
     return moduleBuilder(properties)
+      .files()
+        .add(MAIN_SOURCE.append("proto.lock"), to("src/main/proto/proto.lock"))
+        .and()
       .mavenPlugins()
         .pluginManagement(protoBackwardsCompatibilityMavenPluginManagement())
         .plugin(protoBackwardsCompatibilityMavenPluginBuilder().build())
diff --git a/src/main/resources/generator/server/javatool/protobuf/main/proto.lock b/src/main/resources/generator/server/javatool/protobuf/main/proto.lock
new file mode 100644
index 000000000..9e26dfeeb
--- /dev/null
+++ b/src/main/resources/generator/server/javatool/protobuf/main/proto.lock
@@ -0,0 +1,1 @@
+{}
\ No newline at end of file


Test patch:
diff --git a/src/test/java/tech/jhipster/lite/generator/server/javatool/protobuf/domain/ProtobufModuleFactoryTest.java b/src/test/java/tech/jhipster/lite/generator/server/javatool/protobuf/domain/ProtobufModuleFactoryTest.java
index f2d13c707..a23ce8c2f 100644
--- a/src/test/java/tech/jhipster/lite/generator/server/javatool/protobuf/domain/ProtobufModuleFactoryTest.java
+++ b/src/test/java/tech/jhipster/lite/generator/server/javatool/protobuf/domain/ProtobufModuleFactoryTest.java
@@ -174,7 +174,10 @@ class ProtobufModuleFactoryTest {
                   <artifactId>proto-backwards-compatibility</artifactId>
                 </plugin>
           """
-        );
+        )
+        .and()
+        .hasFile("src/main/proto/proto.lock")
+        .containing("{}");
     }
   }
 }
Repository: jhipster/jhipster-lite
Pull request #10022 (2024-06-09 14:28:55)

React: bump @testing-library/react from 15.0.7 to 16.0.0
Fix #9985 


Patch:
diff --git a/src/main/java/tech/jhipster/lite/generator/client/react/core/domain/ReactCoreModulesFactory.java b/src/main/java/tech/jhipster/lite/generator/client/react/core/domain/ReactCoreModulesFactory.java
index 90f346725..0d10aea08 100644
--- a/src/main/java/tech/jhipster/lite/generator/client/react/core/domain/ReactCoreModulesFactory.java
+++ b/src/main/java/tech/jhipster/lite/generator/client/react/core/domain/ReactCoreModulesFactory.java
@@ -33,6 +33,7 @@ public class ReactCoreModulesFactory {
     //@formatter:off
     return ClientsModulesFactory.clientModuleBuilder(properties)
       .packageJson()
+        .addDevDependency(packageName("@testing-library/dom"), REACT)
         .addDevDependency(packageName("@testing-library/react"), REACT)
         .addDevDependency(packageName("@types/node"), COMMON)
         .addDevDependency(packageName("@types/react"), REACT)
diff --git a/src/main/resources/generator/dependencies/react/package.json b/src/main/resources/generator/dependencies/react/package.json
index f9fa1bcde..76601ee17 100644
--- a/src/main/resources/generator/dependencies/react/package.json
+++ b/src/main/resources/generator/dependencies/react/package.json
@@ -12,7 +12,8 @@
     "react-hook-form": "7.51.5"
   },
   "devDependencies": {
-    "@testing-library/react": "15.0.7",
+    "@testing-library/dom": "10.1.0",
+    "@testing-library/react": "16.0.0",
     "@types/react": "18.3.3",
     "@types/react-dom": "18.3.0",
     "@vitejs/plugin-react": "4.3.0",


Test patch:
diff --git a/src/test/java/tech/jhipster/lite/generator/client/react/core/domain/ReactCoreModulesFactoryTest.java b/src/test/java/tech/jhipster/lite/generator/client/react/core/domain/ReactCoreModulesFactoryTest.java
index ff4af94ac..1c44baf5b 100644
--- a/src/test/java/tech/jhipster/lite/generator/client/react/core/domain/ReactCoreModulesFactoryTest.java
+++ b/src/test/java/tech/jhipster/lite/generator/client/react/core/domain/ReactCoreModulesFactoryTest.java
@@ -21,6 +21,7 @@ class ReactCoreModulesFactoryTest {
 
     assertThatModuleWithFiles(module, packageJsonFile(), lintStagedConfigFile())
       .hasFile("package.json")
+      .containing(nodeDependency("@testing-library/dom"))
       .containing(nodeDependency("@testing-library/react"))
       .containing(nodeDependency("@types/node"))
       .containing(nodeDependency("@types/react"))
Repository: jhipster/jhipster-lite
Pull request #10600 (2024-08-18 20:47:05)

feat(typescript): generates the node project with the type "module"
See  #10544
See https://github.com/jhipster/jhipster-lite/issues/10421


Patch:
diff --git a/src/main/java/tech/jhipster/lite/generator/typescript/core/domain/TypescriptModuleFactory.java b/src/main/java/tech/jhipster/lite/generator/typescript/core/domain/TypescriptModuleFactory.java
index ebc478086..8b7e41102 100644
--- a/src/main/java/tech/jhipster/lite/generator/typescript/core/domain/TypescriptModuleFactory.java
+++ b/src/main/java/tech/jhipster/lite/generator/typescript/core/domain/TypescriptModuleFactory.java
@@ -18,6 +18,7 @@ public class TypescriptModuleFactory {
     //@formatter:off
     return moduleBuilder(properties)
       .packageJson()
+        .addType("module")
         .addDevDependency(packageName("typescript"), COMMON)
         .addDevDependency(packageName("@tsconfig/recommended"), COMMON)
         .addDevDependency(packageName("@typescript-eslint/eslint-plugin"), COMMON)


Test patch:
diff --git a/src/test/java/tech/jhipster/lite/generator/typescript/domain/core/TypescriptModuleFactoryTest.java b/src/test/java/tech/jhipster/lite/generator/typescript/domain/core/TypescriptModuleFactoryTest.java
index 1c4839fe3..ba994c07f 100644
--- a/src/test/java/tech/jhipster/lite/generator/typescript/domain/core/TypescriptModuleFactoryTest.java
+++ b/src/test/java/tech/jhipster/lite/generator/typescript/domain/core/TypescriptModuleFactoryTest.java
@@ -23,6 +23,7 @@ class TypescriptModuleFactoryTest {
 
     assertThatModuleWithFiles(module, packageJsonFile())
       .hasFile("package.json")
+      .containing("\"type\": \"module\"")
       .containing(nodeDependency("typescript"))
       .containing(nodeDependency("@tsconfig/recommended"))
       .containing(nodeDependency("@typescript-eslint/eslint-plugin"))
Repository: jmrozanec/cron-utils
Pull request #307 (2017-12-20 15:01:15)

Fix string representation of On field with L
Previously, the expression `L-3` would be serialized as `L-3L`


Patch:
diff --git a/src/main/java/com/cronutils/model/field/expression/On.java b/src/main/java/com/cronutils/model/field/expression/On.java
index da0f51c..cbe8c6d 100644
--- a/src/main/java/com/cronutils/model/field/expression/On.java
+++ b/src/main/java/com/cronutils/model/field/expression/On.java
@@ -81,7 +81,7 @@ public class On extends FieldExpression {
     }
 
     private String getNthStringRepresentation() {
-        return getNth().getValue() > 0 ? String.format("-%sL", getNth()) : StringUtils.EMPTY;
+        return isDefault(getNth()) ? StringUtils.EMPTY : String.format("-%s", getNth());
     }
 
     private boolean isDefault(final IntegerFieldValue fieldValue) {


Test patch:
diff --git a/src/test/java/com/cronutils/model/field/expression/OnTest.java b/src/test/java/com/cronutils/model/field/expression/OnTest.java
index 8ceb34c..06680bc 100755
--- a/src/test/java/com/cronutils/model/field/expression/OnTest.java
+++ b/src/test/java/com/cronutils/model/field/expression/OnTest.java
@@ -66,6 +66,12 @@ public class OnTest {
         assertEquals(expression, new On(new SpecialCharFieldValue(SpecialChar.L)).asString());
     }
 
+    @Test
+    public void testAsStringSpecialCharLWithNth() {
+        final String expression = "L-3";
+        assertEquals(expression, new On(new IntegerFieldValue(-1), new SpecialCharFieldValue(SpecialChar.L), new IntegerFieldValue(3)).asString());
+    }
+
     @Test
     public void testAsStringWithNth() {
         final int first = 3;
Repository: jmrozanec/cron-utils
Pull request #357 (2018-10-28 16:44:41)

#300 - Fix UnknownFormatConversionException
Fixes the UnknownFormatConversionException for the year portion.

There is a bad description when describing every X months (ex. */2 on the month gives `every February months` instead of `every 2 months`), but I think that should be another issue.


Patch:
diff --git a/src/main/java/com/cronutils/descriptor/CronDescriptor.java b/src/main/java/com/cronutils/descriptor/CronDescriptor.java
index 74ef416..c1bca5d 100755
--- a/src/main/java/com/cronutils/descriptor/CronDescriptor.java
+++ b/src/main/java/com/cronutils/descriptor/CronDescriptor.java
@@ -149,12 +149,12 @@ public class CronDescriptor {
      * @return description - String
      */
     public String describeYear(final Map<CronFieldName, CronField> fields) {
-        return String.format(
+        final String description =
                 DescriptionStrategyFactory.plainInstance(
                         resourceBundle,
                         fields.containsKey(CronFieldName.YEAR) ? fields.get(CronFieldName.YEAR).getExpression() : null
-                ).describe(),
-                resourceBundle.getString("year"));
+                ).describe();
+        return addExpressions(description, resourceBundle.getString("year"), resourceBundle.getString("years"));
     }
 
     /**


Test patch:
diff --git a/src/test/java/com/cronutils/utils/descriptor/CronDescriptorQuartzIntegrationTest.java b/src/test/java/com/cronutils/utils/descriptor/CronDescriptorQuartzIntegrationTest.java
index 54a961b..c127599 100755
--- a/src/test/java/com/cronutils/utils/descriptor/CronDescriptorQuartzIntegrationTest.java
+++ b/src/test/java/com/cronutils/utils/descriptor/CronDescriptorQuartzIntegrationTest.java
@@ -125,6 +125,11 @@ public class CronDescriptorQuartzIntegrationTest {
         assertExpression("0 0 0 ? * MON-FRI *", "at 00:00 every day between Monday and Friday");
     }
 
+    @Test
+    public void testEveryTwoYears() {
+        assertExpression("*/4 */6 */8 */2 * ? */2", "every 4 seconds every 6 minutes every 8 hours every 2 days every 2 years");
+    }
+
     private void assertExpression(final String cron, final String description) {
         assertEquals(description, descriptor.describe(parser.parse(cron)));
     }
Repository: jmrozanec/cron-utils
Pull request #383 (2019-06-13 01:10:27)

Fixed issue #382 (millis truncation when calculating last execution).


Patch:
diff --git a/src/main/java/com/cronutils/model/time/SingleExecutionTime.java b/src/main/java/com/cronutils/model/time/SingleExecutionTime.java
index 73aa802..8ea2d58 100755
--- a/src/main/java/com/cronutils/model/time/SingleExecutionTime.java
+++ b/src/main/java/com/cronutils/model/time/SingleExecutionTime.java
@@ -346,7 +346,7 @@ public class SingleExecutionTime implements ExecutionTime {
         if (!seconds.getValues().contains(date.getSecond())) {
             return getPreviousPotentialSecond(date);
         }
-        return new ExecutionTimeResult(date, true);
+        return new ExecutionTimeResult(date.truncatedTo(SECONDS), true);
     }
 
     private ExecutionTimeResult getPreviousPotentialYear(final ZonedDateTime date, final TimeNode days, final int highestMonth, int highestDay,


Test patch:
diff --git a/src/test/java/com/cronutils/Issue382Test.java b/src/test/java/com/cronutils/Issue382Test.java
new file mode 100644
index 0000000..d319171
--- /dev/null
+++ b/src/test/java/com/cronutils/Issue382Test.java
@@ -0,0 +1,29 @@
+package com.cronutils;
+
+import com.cronutils.model.Cron;
+import com.cronutils.model.CronType;
+import com.cronutils.model.definition.CronDefinitionBuilder;
+import com.cronutils.model.time.ExecutionTime;
+import com.cronutils.parser.CronParser;
+import org.junit.Test;
+
+import java.time.ZonedDateTime;
+
+import static java.time.Duration.ofMillis;
+import static java.time.ZoneOffset.UTC;
+import static org.junit.Assert.assertEquals;
+
+public class Issue382Test {
+
+    @Test
+    public void testLastExecutionWithMillis() {
+        CronParser cronParser = new CronParser(CronDefinitionBuilder.instanceDefinitionFor(CronType.UNIX));
+        String cronString = "0 0 * * WED";
+        Cron cron = cronParser.parse(cronString);
+        ExecutionTime executionTime = ExecutionTime.forCron(cron);
+
+        ZonedDateTime date = ZonedDateTime.of(2019, 6, 12, 0, 0, 0, 0, UTC);
+        ZonedDateTime lastExecution = executionTime.lastExecution(date.plus(ofMillis(300))).get();
+        assertEquals(date, lastExecution);
+    }
+}
diff --git a/src/test/java/com/cronutils/model/time/generator/ExecutionTimeUnixIntegrationTest.java b/src/test/java/com/cronutils/model/time/generator/ExecutionTimeUnixIntegrationTest.java
index 85691b8..31b9c94 100755
--- a/src/test/java/com/cronutils/model/time/generator/ExecutionTimeUnixIntegrationTest.java
+++ b/src/test/java/com/cronutils/model/time/generator/ExecutionTimeUnixIntegrationTest.java
@@ -556,7 +556,7 @@ public class ExecutionTimeUnixIntegrationTest {
         time = time.plus(diff);
         final Optional<Duration> timeFromLastExecution = ExecutionTime.forCron(cron).timeFromLastExecution(time);
         if (timeFromLastExecution.isPresent()) {
-            assertEquals(timeFromLastExecution.get(), Duration.ofDays(1).plus(diff));
+            assertEquals(timeFromLastExecution.get(), diff);
         } else {
             fail(LAST_EXECUTION_NOT_PRESENT_ERROR);
         }