Github user keith-turner commented on a diff in the pull request:
https://github.com/apache/accumulo/pull/235#discussion_r107944404
--- Diff:
core/src/test/java/org/apache/accumulo/core/conf/AccumuloConfigurationTest.java
---
@@ -25,16 +25,17 @@
@Test
public void testGetMemoryInBytes() throws Exception {
- assertEquals(42l, AccumuloConfiguration.getMemoryInBytes("42"));
- assertEquals(42l, AccumuloConfiguration.getMemoryInBytes("42b"));
- assertEquals(42l, AccumuloConfiguration.getMemoryInBytes("42B"));
- assertEquals(42l * 1024l,
AccumuloConfiguration.getMemoryInBytes("42K"));
- assertEquals(42l * 1024l,
AccumuloConfiguration.getMemoryInBytes("42k"));
- assertEquals(42l * 1024l * 1024l,
AccumuloConfiguration.getMemoryInBytes("42M"));
- assertEquals(42l * 1024l * 1024l,
AccumuloConfiguration.getMemoryInBytes("42m"));
- assertEquals(42l * 1024l * 1024l * 1024l,
AccumuloConfiguration.getMemoryInBytes("42G"));
- assertEquals(42l * 1024l * 1024l * 1024l,
AccumuloConfiguration.getMemoryInBytes("42g"));
-
+ assertEquals(42l, AccumuloConfiguration.getFixedMemoryAsBytes("42"));
--- End diff --
Could apply all of these fixed memory string test to both functions. The
following is one way to do this in Java 8 I was playing around with. Is there
a shorter way to create the list of functions?
```java
List<Function<String,Long>> funcs =
Arrays.asList(AccumuloConfiguration::getFixedMemoryAsBytes,
AccumuloConfiguration::getMemoryAsBytes);
for(Function<String,Long> memFunc : funcs) {
assertEquals(42l, memFunc.apply("42"));
//rest of asserts
}
```
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---