Home | About | Sematext search-lucene.com search-hadoop.com
 Search Hadoop and all its subprojects:

Switch to Plain View
Accumulo >> mail # dev >> Using powermock-api-mockito in tests?


Copy link to this message
-
Using powermock-api-mockito in tests?
Is there any reason why I should not add a dependency in start/pom.xml
to powermock-api-mockito? With this library, we can mock the call to
System.getenv() which breaks the tests in AccumuloVFSClassLoaderTest.
The two tests need these four lines of setup in order to pass:

      Map<String, String> mockSystemProperties = new HashMap<String, String>();
      mockSystemProperties.put("ACCUMULO_HOME", System.getenv("HOME"));

      PowerMockito.mockStatic(System.class);
      Mockito.when(System.getenv()).thenReturn(mockSystemProperties);

You'll notice that set ACCUMULO_HOME is set to the value of HOME to
make the test cross-platform.
+
dlmarion@... 2013-03-21, 21:11
+
Dave Marion 2013-03-21, 22:40
+
David Medinets 2013-03-22, 01:26
+
dlmarion@... 2013-03-22, 01:44
+
Josh Elser 2013-03-21, 22:43
+
Dave Marion 2013-03-21, 23:11
+
dlmarion@... 2013-03-22, 01:50
+
David Medinets 2013-03-22, 01:58
+
dlmarion@... 2013-03-22, 02:03
+
David Medinets 2013-03-22, 02:08
+
dlmarion@... 2013-03-22, 02:16
+
Keith Turner 2013-03-22, 14:11
+
Jim Klucar 2013-03-22, 14:42
+
David Medinets 2013-03-22, 21:42
+
Dave Marion 2013-03-22, 22:48
+
David Medinets 2013-03-22, 23:54