gemini-code-assist[bot] commented on code in PR #37775:
URL: https://github.com/apache/beam/pull/37775#discussion_r2905797427


##########
sdks/java/io/azure/src/test/java/org/apache/beam/sdk/io/azure/blobstore/AzureBlobStoreFileSystemTest.java:
##########
@@ -111,7 +111,8 @@ public void beforeClass() {
     when(mockedBlobClient.getBlockBlobClient()).thenReturn(mockedBlockBlob);
     when(mockedBlobClient.getProperties()).thenReturn(mockedProperties);
     when(mockedProperties.getBlobSize()).thenReturn(Long.valueOf(1));
-    when(mockedProperties.getLastModified()).thenReturn(OffsetDateTime.now());
+    when(mockedProperties.getLastModified())
+        .thenReturn(OffsetDateTime.now(java.time.ZoneOffset.UTC));

Review Comment:
   ![medium](https://www.gstatic.com/codereviewagent/medium-priority.svg)
   
   To improve readability, please add an import for `java.time.ZoneOffset` and 
use `ZoneOffset.UTC` directly. This aligns with the Google Java Style Guide's 
preference for simple names over fully-qualified ones when unambiguous.
   
   ```suggestion
       when(mockedProperties.getLastModified())
           .thenReturn(OffsetDateTime.now(ZoneOffset.UTC));
   ```
   
   <details>
   <summary>References</summary>
   
   1. The Google Java Style Guide (section 6.2) recommends using the simple 
name of a class when it is unambiguous, rather than the fully-qualified name. 
Importing `ZoneOffset` and using its simple name improves code readability. 
<sup>([link](http://console.cloud.google.com/gemini-code-assist/agents-tools))</sup>
   </details>



##########
sdks/java/extensions/sql/src/test/java/org/apache/beam/sdk/extensions/sql/impl/schema/BeamSqlRowCoderTest.java:
##########
@@ -70,9 +71,9 @@ public void encodeAndDecode() throws Exception {
                 1.1,
                 BigDecimal.ZERO,
                 "hello",
-                LocalTime.now(),
-                LocalDate.now(),
-                LocalDateTime.now(),
+                LocalTime.now(ZoneId.of("UTC")),
+                LocalDate.now(ZoneId.of("UTC")),
+                LocalDateTime.now(ZoneId.of("UTC")),

Review Comment:
   ![medium](https://www.gstatic.com/codereviewagent/medium-priority.svg)
   
   For consistency with other changes in this PR, please use `ZoneOffset.UTC` 
instead of `ZoneId.of("UTC")`. This requires replacing the import for 
`java.time.ZoneId` with `java.time.ZoneOffset`.
   
   ```suggestion
                   LocalTime.now(ZoneOffset.UTC),
                   LocalDate.now(ZoneOffset.UTC),
                   LocalDateTime.now(ZoneOffset.UTC),
   ```



##########
sdks/java/extensions/sbe/src/test/java/org/apache/beam/sdk/extensions/sbe/SbeLogicalTypesTest.java:
##########
@@ -59,7 +59,7 @@ public void testTzTimestamp() {
 
   @Test
   public void testUtcTimeOnly() {
-    LocalTime time = LocalTime.now();
+    LocalTime time = LocalTime.now(ZoneId.of("UTC"));

Review Comment:
   ![medium](https://www.gstatic.com/codereviewagent/medium-priority.svg)
   
   For consistency with other changes in this PR, please use `ZoneOffset.UTC` 
instead of `ZoneId.of("UTC")`. This also applies to the other occurrences in 
this file (lines 82 and 92). This requires adding an import for 
`java.time.ZoneOffset`.
   
   ```suggestion
       LocalTime time = LocalTime.now(ZoneOffset.UTC);
   ```



##########
sdks/java/io/elasticsearch-tests/elasticsearch-tests-common/src/main/java/org/apache/beam/sdk/io/elasticsearch/ElasticsearchIOTestUtils.java:
##########
@@ -343,7 +343,7 @@ static long refreshIndexAndGetCurrentNumDocs(
   static List<String> createDocuments(long numDocs, InjectionMode 
injectionMode) {
 
     ArrayList<String> data = new ArrayList<>();
-    LocalDateTime baseDateTime = LocalDateTime.now();
+    LocalDateTime baseDateTime = LocalDateTime.now(java.time.ZoneOffset.UTC);

Review Comment:
   ![medium](https://www.gstatic.com/codereviewagent/medium-priority.svg)
   
   To improve readability, please add an import for `java.time.ZoneOffset` and 
use `ZoneOffset.UTC` directly. This aligns with the Google Java Style Guide's 
preference for simple names over fully-qualified ones when unambiguous.
   
   ```suggestion
       LocalDateTime baseDateTime = LocalDateTime.now(ZoneOffset.UTC);
   ```
   
   <details>
   <summary>References</summary>
   
   1. The Google Java Style Guide (section 6.2) recommends using the simple 
name of a class when it is unambiguous, rather than the fully-qualified name. 
Importing `ZoneOffset` and using its simple name improves code readability. 
<sup>([link](http://console.cloud.google.com/gemini-code-assist/agents-tools))</sup>
   </details>



##########
sdks/java/io/google-cloud-platform/src/test/java/org/apache/beam/sdk/io/gcp/bigquery/BeamRowToStorageApiProtoTest.java:
##########
@@ -253,9 +254,9 @@ public class BeamRowToStorageApiProtoTest {
           .withFieldValue("arrayValue", ImmutableList.of("one", "two", "red", 
"blue"))
           .withFieldValue("arrayNullValue", null)
           .withFieldValue("iterableValue", ImmutableList.of("blue", "red", 
"two", "one"))
-          .withFieldValue("sqlDateValue", LocalDate.now())
-          .withFieldValue("sqlTimeValue", LocalTime.now())
-          .withFieldValue("sqlDatetimeValue", LocalDateTime.now())
+          .withFieldValue("sqlDateValue", LocalDate.now(ZoneId.of("UTC")))
+          .withFieldValue("sqlTimeValue", LocalTime.now(ZoneId.of("UTC")))
+          .withFieldValue("sqlDatetimeValue", 
LocalDateTime.now(ZoneId.of("UTC")))

Review Comment:
   ![medium](https://www.gstatic.com/codereviewagent/medium-priority.svg)
   
   For consistency with other changes in this PR, please use `ZoneOffset.UTC` 
instead of `ZoneId.of("UTC")`. This requires replacing the import for 
`java.time.ZoneId` with `java.time.ZoneOffset`.
   
   ```suggestion
             .withFieldValue("sqlDateValue", LocalDate.now(ZoneOffset.UTC))
             .withFieldValue("sqlTimeValue", LocalTime.now(ZoneOffset.UTC))
             .withFieldValue("sqlDatetimeValue", 
LocalDateTime.now(ZoneOffset.UTC))
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to