You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@accumulo.apache.org by GitBox <gi...@apache.org> on 2022/02/22 22:17:50 UTC

[GitHub] [accumulo] KikiManjaro commented on a change in pull request #2515: replace some calculation with TimeUnit

KikiManjaro commented on a change in pull request #2515:
URL: https://github.com/apache/accumulo/pull/2515#discussion_r812406685



##########
File path: core/src/test/java/org/apache/accumulo/core/conf/ConfigurationTypeHelperTest.java
##########
@@ -80,11 +81,11 @@ public void testGetMemoryAsBytesFailureCases2() {
 
   @Test
   public void testGetTimeInMillis() {
-    assertEquals(42L * 24 * 60 * 60 * 1000, ConfigurationTypeHelper.getTimeInMillis("42d"));
-    assertEquals(42L * 60 * 60 * 1000, ConfigurationTypeHelper.getTimeInMillis("42h"));
-    assertEquals(42L * 60 * 1000, ConfigurationTypeHelper.getTimeInMillis("42m"));
-    assertEquals(42L * 1000, ConfigurationTypeHelper.getTimeInMillis("42s"));
-    assertEquals(42L * 1000, ConfigurationTypeHelper.getTimeInMillis("42"));
+    assertEquals(DAYS.toMillis(42), ConfigurationTypeHelper.getTimeInMillis("42d"));
+    assertEquals(HOURS.toMillis(42), ConfigurationTypeHelper.getTimeInMillis("42h"));
+    assertEquals(MINUTES.toMillis(42), ConfigurationTypeHelper.getTimeInMillis("42m"));
+    assertEquals(SECONDS.toMillis(42), ConfigurationTypeHelper.getTimeInMillis("42s"));
+    assertEquals(42_000L, ConfigurationTypeHelper.getTimeInMillis("42"));

Review comment:
       42_000L seemed shorter and cleaner to me :p




-- 
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: notifications-unsubscribe@accumulo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org