mmiklavc commented on a change in pull request #1399: METRON-2073: Create 
in-memory use case for enrichment with map type and flatfile summarizer
URL: https://github.com/apache/metron/pull/1399#discussion_r287023274
 
 

 ##########
 File path: 
metron-platform/metron-enrichment/metron-enrichment-common/src/test/java/org/apache/metron/enrichment/stellar/ObjectGetTest.java
 ##########
 @@ -18,73 +18,88 @@
 
 package org.apache.metron.enrichment.stellar;
 
-import com.google.common.collect.ImmutableMap;
-import org.apache.commons.io.IOUtils;
-import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.fs.FileSystem;
-import org.apache.hadoop.fs.Path;
-import org.apache.metron.common.utils.SerDeUtils;
-import org.apache.metron.stellar.common.utils.StellarProcessorUtils;
-import org.junit.Assert;
+import org.apache.metron.enrichment.cache.ObjectCache;
+import org.apache.metron.enrichment.cache.ObjectCacheConfig;
+import org.apache.metron.stellar.dsl.Context;
 import org.junit.Before;
+import org.junit.Rule;
 import org.junit.Test;
+import org.junit.rules.ExpectedException;
+import org.junit.runner.RunWith;
+import org.powermock.core.classloader.annotations.PrepareForTest;
+import org.powermock.modules.junit4.PowerMockRunner;
 
-import java.io.BufferedOutputStream;
-import java.io.IOException;
 import java.util.ArrayList;
+import java.util.Collections;
 import java.util.HashMap;
-import java.util.List;
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+import static org.powermock.api.mockito.PowerMockito.whenNew;
+
+@RunWith(PowerMockRunner.class)
+@PrepareForTest({ObjectGet.class, ObjectCache.class})
 public class ObjectGetTest {
-  FileSystem fs;
-  List<String> data;
+  @Rule
+  public ExpectedException thrown = ExpectedException.none();
+
+  private ObjectGet objectGet;
+  private ObjectCache objectCache;
+  private Context context;
 
   @Before
-  public void setup() throws IOException {
-    fs = FileSystem.get(new Configuration());
-    data = new ArrayList<>();
-    {
-      data.add("apache");
-      data.add("metron");
-      data.add("is");
-      data.add("great");
-    }
+  public void setup() throws Exception {
+    objectGet = new ObjectGet();
+    objectCache = mock(ObjectCache.class);
 
 Review comment:
   I think that makes sense, thanks @merrimanr.
   
   Can you make sure we're setting sensible defaults for the cache as well? 
These two items surprise me that they would matter for this test:
   
   1. Create an arbitrary cache configuration
   2. Setup and instantiate the cache
   
   It also wasn't clear to me that I'd have to do those things, even after 
spending a lot of time going over the code. I would have thought that I can 
just do `new ObjectCache(simpleLoader)`, where `simpleLoader` is a basic stunt 
double reading from a string/bytearray or something, and have config defaults 
that just work. The unit test for `ObjectCache` should be testing all the 
fine-grained details, which are less important here. Likewise, the integration 
tests can just verify that the config is being picked up and passed through - 
no need to test all possible combos from the integration test standpoint.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to