Repository: mockito/mockito
Issue: Mockito should return an empty array for default values
Labels: enhancement
in progress

Mockito returns by default interesting default values for some types : 

* Long ⇒ 0
* Optional ⇒ Optional.empty
* List => new ArrayList(0)

But it don't return an empty array currently.

Issue comments:
Do you mean argument matcher or mock return values?
I mean default return value of a mock.
Here is a quick fix, sadly I can't push throu the firewall.

```java
if (type.isArray()) {
     Class<?> componentType = type.getComponentType();
    return Array.newInstance(componentType, 0);
}
```

needs to added to [ReturnsEmptyValues::returnValueFor(Class)](https://github.com/mockito/mockito/blob/release/2.x/src/main/java/org/mockito/internal/stubbing/defaultanswers/ReturnsEmptyValues.java#L79).
Seems like String has also no empty return value.
Yes the fix is quite easy. I haven't pushed it yet. I'm focused on the selection of the Devoxx France CFP right now.

`String` was discussed, at some point but most people felt `null` was a sane default even for `String`.
Please consider backwards compatibility when implementing the fix. Thanks!

That's indeed a good point, I'm hesitating. Since mockito returns non null collections, it seems a consistent to return a non null array by default too.

If merging this one in mockito 2, that may break tests that rely on the default behavior only.
That requires at the very least a minor version bumb. I'm quite enclined to get it right in mockito 2, but it could it wait for mockito 3.


While cleaning stuff, just noticed there's a `ReturnsMoreEmptyValues` that already do that.

However it does more things than simply retuning non emtpy arrays. It returns empty strings too.
Nice catch! ReturnsMoreEmptyValues was intended to replace ReturnEmptyValues in the next major version of Mockito. However, it was deprioritized and/or forgotten and we never got to do it.

Including this change in Mockito 2 will potentially break tests. The failure may not be easy to debug / understand (sudden change of behavior of test). Such changes should only be included in major version update and well documented. Given our strong desire for compatibility, let's include it in Mockito 3. I suggest we also review other empty / default return values in Mockito 3.
@szczepiq Yes in the end I only pushed the change to target master in #897 

Pull request review comments:
If this class now only returns an emptry String, why don't we remove this class and move the empty string to `ReturnsEmptyValues`?
Actually I don't think that's part of this PR. And I find that returning empty string instead of `null` more debattable (hence a separate PR).
Oh nice! It's good to take advantage of Java8!
Fantastic! Less code to maintain.
I like the idea to condense the tests into 2 methods.
As general feedback, not particularly to this PR, I'm +1 to returning empty String. We can poll more feedback from the community. Empty String seems like a better default, avoiding potential NPE. The idea behind the defaults is to return the most sensible value if the user does not care about the mock.
@szczepiq Let's create another PR for default Strings, it'll be easier to track for end users as it will appear in the changelog.

Patch that resolved the issue:
diff --git a/src/main/java/org/mockito/internal/stubbing/defaultanswers/ReturnsEmptyValues.java b/src/main/java/org/mockito/internal/stubbing/defaultanswers/ReturnsEmptyValues.java
index 2216cca7aa..e667b19811 100644
--- a/src/main/java/org/mockito/internal/stubbing/defaultanswers/ReturnsEmptyValues.java
+++ b/src/main/java/org/mockito/internal/stubbing/defaultanswers/ReturnsEmptyValues.java
@@ -4,9 +4,31 @@
  */
 package org.mockito.internal.stubbing.defaultanswers;
 
-import org.mockito.internal.util.JavaEightUtil;
+import java.io.Serializable;
+import java.lang.reflect.Array;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.LinkedHashMap;
+import java.util.LinkedHashSet;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.Optional;
+import java.util.OptionalDouble;
+import java.util.OptionalInt;
+import java.util.OptionalLong;
+import java.util.Set;
+import java.util.SortedMap;
+import java.util.SortedSet;
+import java.util.TreeMap;
+import java.util.TreeSet;
+import java.util.stream.DoubleStream;
+import java.util.stream.IntStream;
+import java.util.stream.LongStream;
+import java.util.stream.Stream;
 import org.mockito.internal.util.MockUtil;
-import org.mockito.internal.util.ObjectMethodsGuru;
 import org.mockito.internal.util.Primitives;
 import org.mockito.invocation.InvocationOnMock;
 import org.mockito.mock.MockName;
@@ -15,36 +37,19 @@
 import static org.mockito.internal.util.ObjectMethodsGuru.isCompareToMethod;
 import static org.mockito.internal.util.ObjectMethodsGuru.isToStringMethod;
 
-import java.io.Serializable;
-import java.util.*;
-
 /**
  * Default answer of every Mockito mock.
  * <ul>
- * <li>
- * Returns appropriate primitive for primitive-returning methods
- * </li>
- * <li>
- * Returns consistent values for primitive wrapper classes (e.g. int-returning method returns 0 <b>and</b> Integer-returning method returns 0, too)
- * </li>
- * <li>
- * Returns empty collection for collection-returning methods (works for most commonly used collection types)
- * </li>
- * <li>
- * Returns description of mock for toString() method
- * </li>
- * <li>
- * Returns zero if references are equals otherwise non-zero for Comparable#compareTo(T other) method (see issue 184)
- * </li>
- * <li>
- * Returns an {@code java.util.Optional#empty() empty Optional} for Optional. Similarly for primitive optional variants.
- * </li>
- * <li>
- * Returns an {@code java.util.stream.Stream#empty() empty Stream} for Stream. Similarly for primitive stream variants.
- * </li>
- * <li>
- * Returns null for everything else
- * </li>
+ * <li>Returns appropriate primitive for primitive-returning methods</li>
+ * <li>Returns consistent values for primitive wrapper classes (e.g. int-returning method returns 0 <strong>and</strong>
+ *     Integer-returning method returns 0, too)</li>
+ * <li>Returns empty collection for collection-returning methods (works for most commonly used collection types)</li>
+ * <li>Returns empty array for array-returning methods</li>
+ * <li>Returns description of mock for toString() method</li>
+ * <li>Returns zero if references are equals otherwise non-zero for Comparable#compareTo(T other) method (see issue 184)</li>
+ * <li>Returns an {@link java.util.Optional#empty() empty Optional} for Optional. Similarly for primitive optional variants.</li>
+ * <li>Returns an {@link java.util.stream.Stream#empty() empty Stream} for Stream. Similarly for primitive stream variants.</li>
+ * <li>Returns null for everything else</li>
  * </ul>
  */
 public class ReturnsEmptyValues implements Answer<Object>, Serializable {
@@ -52,9 +57,6 @@ public class ReturnsEmptyValues implements Answer<Object>, Serializable {
     private static final long serialVersionUID = 1998191268711234347L;
 
 
-    /* (non-Javadoc)
-     * @see org.mockito.stubbing.Answer#answer(org.mockito.invocation.InvocationOnMock)
-     */
     public Object answer(InvocationOnMock invocation) {
         if (isToStringMethod(invocation.getMethod())) {
             Object mock = invocation.getMock();
@@ -80,6 +82,9 @@ Object returnValueFor(Class<?> type) {
             return Primitives.defaultValue(type);
             //new instances are used instead of Collections.emptyList(), etc.
             //to avoid UnsupportedOperationException if code under test modifies returned collection
+        } else if (type.isArray()) {
+            Class<?> componentType = type.getComponentType();
+            return Array.newInstance(componentType, 0);
         } else if (type == Iterable.class) {
             return new ArrayList<Object>(0);
         } else if (type == Collection.class) {
@@ -110,22 +115,22 @@ Object returnValueFor(Class<?> type) {
             return new TreeMap<Object, Object>();
         } else if (type == LinkedHashMap.class) {
             return new LinkedHashMap<Object, Object>();
-        } else if ("java.util.Optional".equals(type.getName())) {
-            return JavaEightUtil.emptyOptional();
-        } else if ("java.util.OptionalDouble".equals(type.getName())) {
-            return JavaEightUtil.emptyOptionalDouble();
-        } else if ("java.util.OptionalInt".equals(type.getName())) {
-            return JavaEightUtil.emptyOptionalInt();
-        } else if ("java.util.OptionalLong".equals(type.getName())) {
-            return JavaEightUtil.emptyOptionalLong();
-        } else if ("java.util.stream.Stream".equals(type.getName())) {
-            return JavaEightUtil.emptyStream();
-        } else if ("java.util.stream.DoubleStream".equals(type.getName())) {
-            return JavaEightUtil.emptyDoubleStream();
-        } else if ("java.util.stream.IntStream".equals(type.getName())) {
-            return JavaEightUtil.emptyIntStream();
-        } else if ("java.util.stream.LongStream".equals(type.getName())) {
-            return JavaEightUtil.emptyLongStream();
+        } else if (type == Optional.class) {
+            return Optional.empty();
+        } else if (type == OptionalDouble.class) {
+            return OptionalDouble.empty();
+        } else if (type == OptionalInt.class) {
+            return OptionalInt.empty();
+        } else if (type == OptionalLong.class) {
+            return OptionalLong.empty();
+        } else if (type == Stream.class) {
+            return Stream.empty();
+        } else if (type == DoubleStream.class) {
+            return DoubleStream.empty();
+        } else if (type == IntStream.class) {
+            return IntStream.empty();
+        } else if (type == LongStream.class) {
+            return LongStream.empty();
         }
 
         //Let's not care about the rest of collections.
diff --git a/src/main/java/org/mockito/internal/stubbing/defaultanswers/ReturnsMoreEmptyValues.java b/src/main/java/org/mockito/internal/stubbing/defaultanswers/ReturnsMoreEmptyValues.java
index 179f7ddc8b..0b612ef4c9 100644
--- a/src/main/java/org/mockito/internal/stubbing/defaultanswers/ReturnsMoreEmptyValues.java
+++ b/src/main/java/org/mockito/internal/stubbing/defaultanswers/ReturnsMoreEmptyValues.java
@@ -6,7 +6,6 @@
 package org.mockito.internal.stubbing.defaultanswers;
 
 import java.io.Serializable;
-import java.lang.reflect.Array;
 import org.mockito.Mockito;
 import org.mockito.invocation.InvocationOnMock;
 import org.mockito.stubbing.Answer;
@@ -16,42 +15,18 @@
  * <p>
  * Currently <b>used only</b> by {@link Mockito#RETURNS_SMART_NULLS}
  * <p>
- * Current version of Mockito mocks by deafult use {@link ReturnsEmptyValues}  
+ * Current version of Mockito mocks by default use {@link ReturnsEmptyValues}
  * <ul>
- * <li>
- *  Returns appropriate primitive for primitive-returning methods
- * </li>
- * <li>
- *  Returns consistent values for primitive wrapper classes (e.g. int-returning method retuns 0 <b>and</b> Integer-returning method returns 0, too)
- * </li>
- * <li>
- *  Returns empty collection for collection-returning methods (works for most commonly used collection types)
- * </li>
- * <li>
- *  Returns empty array for array-returning methods
- * </li>
- * <li>
- *  Returns "" for String-returning method
- * </li>
- * <li>
- *  Returns description of mock for toString() method
- * </li>
- * <li>
- *  Returns non-zero for Comparable#compareTo(T other) method (see issue 184)
- * </li>
- * <li>
- *  Returns null for everything else
- * </li>
+ * <li>Returns empty values of {@link ReturnsEmptyValues}</li>
+ * <li>Returns "" for String-returning method</li>
+ * <li>Returns null for everything else</li>
  * </ul>
  */
 public class ReturnsMoreEmptyValues implements Answer<Object>, Serializable {
-    
+
     private static final long serialVersionUID = -2816745041482698471L;
     private final Answer<Object> delegate = new ReturnsEmptyValues();
-    
-    /* (non-Javadoc)
-     * @see org.mockito.stubbing.Answer#answer(org.mockito.invocation.InvocationOnMock)
-     */
+
     public Object answer(InvocationOnMock invocation) throws Throwable {
         Object ret = delegate.answer(invocation);
         if (ret != null) {
@@ -61,13 +36,10 @@ public Object answer(InvocationOnMock invocation) throws Throwable {
         Class<?> returnType = invocation.getMethod().getReturnType();
         return returnValueFor(returnType);
     }
-    
+
     Object returnValueFor(Class<?> type) {
         if (type == String.class) {
             return "";
-        }  else if (type.isArray()) {
-            Class<?> componentType = type.getComponentType();
-            return Array.newInstance(componentType, 0);
         }
         return null;
     }
diff --git a/src/main/java/org/mockito/internal/util/JavaEightUtil.java b/src/main/java/org/mockito/internal/util/JavaEightUtil.java
deleted file mode 100644
index 80ac6353c1..0000000000
--- a/src/main/java/org/mockito/internal/util/JavaEightUtil.java
+++ /dev/null
@@ -1,144 +0,0 @@
-/*
- * Copyright (c) 2016 Mockito contributors
- * This program is made available under the terms of the MIT License.
- */
-package org.mockito.internal.util;
-
-import org.mockito.internal.creation.instance.InstantiationException;
-
-import java.lang.reflect.Method;
-
-/**
- * Helper class to work with features that were introduced in Java versions after 1.5.
- * This class uses reflection in most places to avoid coupling with a newer JDK.
- */
-public final class JavaEightUtil {
-
-    // No need for volatile, these optionals are already safe singletons.
-    private static Object emptyOptional;
-    private static Object emptyOptionalDouble;
-    private static Object emptyOptionalInt;
-    private static Object emptyOptionalLong;
-
-    private JavaEightUtil() {
-        // utility class
-    }
-
-    /**
-     * Creates an empty Optional using reflection to stay backwards-compatible with older JDKs.
-     *
-     * @return an empty Optional.
-     */
-    public static Object emptyOptional() {
-        // no need for double-checked locking
-        if (emptyOptional != null) {
-            return emptyOptional;
-        }
-
-        return emptyOptional = invokeNullaryFactoryMethod("java.util.Optional", "empty");
-    }
-
-
-    /**
-     * Creates an empty OptionalDouble using reflection to stay backwards-compatible with older JDKs.
-     *
-     * @return an empty OptionalDouble.
-     */
-    public static Object emptyOptionalDouble() {
-        // no need for double-checked locking
-        if (emptyOptionalDouble != null) {
-            return emptyOptionalDouble;
-        }
-
-        return emptyOptionalDouble = invokeNullaryFactoryMethod("java.util.OptionalDouble", "empty");
-    }
-
-    /**
-     * Creates an empty OptionalInt using reflection to stay backwards-compatible with older JDKs.
-     *
-     * @return an empty OptionalInt.
-     */
-    public static Object emptyOptionalInt() {
-        // no need for double-checked locking
-        if (emptyOptionalInt != null) {
-            return emptyOptionalInt;
-        }
-
-        return emptyOptionalInt = invokeNullaryFactoryMethod("java.util.OptionalInt", "empty");
-    }
-
-    /**
-     * Creates an empty OptionalLong using reflection to stay backwards-compatible with older JDKs.
-     *
-     * @return an empty OptionalLong.
-     */
-    public static Object emptyOptionalLong() {
-        // no need for double-checked locking
-        if (emptyOptionalLong != null) {
-            return emptyOptionalLong;
-        }
-
-        return emptyOptionalLong = invokeNullaryFactoryMethod("java.util.OptionalLong", "empty");
-    }
-
-    /**
-     * Creates an empty Stream using reflection to stay backwards-compatible with older JDKs.
-     *
-     * @return an empty Stream.
-     */
-    public static Object emptyStream() {
-        // note: the empty stream can not be stored as a singleton.
-        return invokeNullaryFactoryMethod("java.util.stream.Stream", "empty");
-    }
-
-    /**
-     * Creates an empty DoubleStream using reflection to stay backwards-compatible with older JDKs.
-     *
-     * @return an empty DoubleStream.
-     */
-    public static Object emptyDoubleStream() {
-        // note: the empty stream can not be stored as a singleton.
-        return invokeNullaryFactoryMethod("java.util.stream.DoubleStream", "empty");
-    }
-
-    /**
-     * Creates an empty IntStream using reflection to stay backwards-compatible with older JDKs.
-     *
-     * @return an empty IntStream.
-     */
-    public static Object emptyIntStream() {
-        // note: the empty stream can not be stored as a singleton.
-        return invokeNullaryFactoryMethod("java.util.stream.IntStream", "empty");
-    }
-
-    /**
-     * Creates an empty LongStream using reflection to stay backwards-compatible with older JDKs.
-     *
-     * @return an empty LongStream.
-     */
-    public static Object emptyLongStream() {
-        // note: the empty stream can not be stored as a singleton.
-        return invokeNullaryFactoryMethod("java.util.stream.LongStream", "empty");
-    }
-
-    /**
-     * Invokes a nullary static factory method using reflection to stay backwards-compatible with older JDKs.
-     *
-     * @param fqcn The fully qualified class name of the type to be produced.
-     * @param methodName The name of the factory method.
-     * @return the object produced.
-     */
-    private static Object invokeNullaryFactoryMethod(final String fqcn, final String methodName) {
-        try {
-            final Class<?> type = Class.forName(fqcn);
-            final Method method = type.getMethod(methodName);
-
-            return method.invoke(null);
-            // any exception is really unexpected since the type name has
-            // already been verified
-        } catch (final Exception e) {
-            throw new InstantiationException(
-                    String.format("Could not create %s#%s(): %s", fqcn, methodName, e), e);
-        }
-    }
-}


Test patch:
diff --git a/src/test/java/org/mockito/internal/stubbing/answers/ThrowsExceptionTest.java b/src/test/java/org/mockito/internal/stubbing/answers/ThrowsExceptionTest.java
index 4406499946..734a6ace7d 100644
--- a/src/test/java/org/mockito/internal/stubbing/answers/ThrowsExceptionTest.java
+++ b/src/test/java/org/mockito/internal/stubbing/answers/ThrowsExceptionTest.java
@@ -28,7 +28,7 @@ public void should_throw_mock_exception_without_stacktrace() throws Exception {
             new ThrowsException(mock(Exception.class)).answer(new InvocationBuilder().method("canThrowException").toInvocation());
             Assertions.fail("should have raised wanted exception");
         } catch (Throwable throwable) {
-            assertThat(throwable.getStackTrace()).describedAs("no stack trace, it's mock").isNull();
+            assertThat(throwable.getStackTrace()).describedAs("no stack trace, it's mock").isEmpty();
         }
     }
 
diff --git a/src/test/java/org/mockito/internal/stubbing/defaultanswers/ReturnsEmptyValuesTest.java b/src/test/java/org/mockito/internal/stubbing/defaultanswers/ReturnsEmptyValuesTest.java
index ab9aad9bd1..861dd5472a 100644
--- a/src/test/java/org/mockito/internal/stubbing/defaultanswers/ReturnsEmptyValuesTest.java
+++ b/src/test/java/org/mockito/internal/stubbing/defaultanswers/ReturnsEmptyValuesTest.java
@@ -5,14 +5,38 @@
 
 package org.mockito.internal.stubbing.defaultanswers;
 
-import org.junit.Assume;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.LinkedHashMap;
+import java.util.LinkedHashSet;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.Optional;
+import java.util.OptionalDouble;
+import java.util.OptionalInt;
+import java.util.OptionalLong;
+import java.util.Set;
+import java.util.SortedMap;
+import java.util.SortedSet;
+import java.util.TreeMap;
+import java.util.TreeSet;
+import java.util.stream.DoubleStream;
+import java.util.stream.IntStream;
+import java.util.stream.LongStream;
+import java.util.stream.Stream;
 import org.junit.Test;
 import org.mockito.invocation.Invocation;
 import org.mockitoutil.TestBase;
 
-import java.util.*;
-
-import static junit.framework.TestCase.*;
+import static junit.framework.TestCase.assertEquals;
+import static junit.framework.TestCase.assertFalse;
+import static junit.framework.TestCase.assertNull;
+import static junit.framework.TestCase.assertTrue;
+import static org.assertj.core.api.Assertions.assertThat;
 import static org.mockito.Mockito.mock;
 
 public class ReturnsEmptyValuesTest extends TestBase {
@@ -21,6 +45,8 @@ public class ReturnsEmptyValuesTest extends TestBase {
 
     @Test
     public void should_return_empty_collections_or_null_for_non_collections() {
+        assertTrue(((Number[]) values.returnValueFor(Number[].class)).length == 0);
+
         assertTrue(((Collection<?>) values.returnValueFor(Collection.class)).isEmpty());
 
         assertTrue(((Set<?>) values.returnValueFor(Set.class)).isEmpty());
@@ -90,84 +116,18 @@ public void should_return_zero_if_mock_is_compared_to_itself() {
 
     @Test
     public void should_return_empty_Optional() throws Exception {
-        verify_empty_Optional_is_returned("java.util.stream.Stream", "java.util.Optional");
-    }
-
-    @Test
-    public void should_return_empty_OptionalDouble() throws Exception {
-        verify_empty_Optional_is_returned("java.util.stream.DoubleStream", "java.util.OptionalDouble");
-    }
-
-    @Test
-    public void should_return_empty_OptionalInt() throws Exception {
-        verify_empty_Optional_is_returned("java.util.stream.IntStream", "java.util.OptionalInt");
-    }
-
-    @Test
-    public void should_return_empty_OptionalLong() throws Exception {
-        verify_empty_Optional_is_returned("java.util.stream.LongStream", "java.util.OptionalLong");
-    }
-
-    private void verify_empty_Optional_is_returned(String streamFqcn, String optionalFqcn) throws Exception {
-        Class<?> streamType = getClassOrSkipTest(streamFqcn);
-
-        //given
-        Object stream = mock(streamType);
-        Object optional = streamType.getMethod("findAny").invoke(stream);
-        assertNotNull(optional);
-        assertFalse((Boolean) Class.forName(optionalFqcn).getMethod("isPresent").invoke(optional));
-
-        Invocation findAny = this.getLastInvocation();
-
-        //when
-        Object result = values.answer(findAny);
-
-        //then
-        assertEquals(optional, result);
-    }
-
-    @Test
-    public void should_return_empty_Stream() throws Exception {
-        verify_empty_Stream_is_returned("java.util.stream.Stream");
-    }
-
-    @Test
-    public void should_return_empty_DoubleStream() throws Exception {
-        verify_empty_Stream_is_returned("java.util.stream.DoubleStream");
-    }
-
-    @Test
-    public void should_return_empty_IntStream() throws Exception {
-        verify_empty_Stream_is_returned("java.util.stream.IntStream");
+        assertThat((Optional) values.returnValueFor(Optional.class)).isEmpty();
+        assertThat((OptionalInt) values.returnValueFor(OptionalInt.class)).isEmpty();
+        assertThat((OptionalLong) values.returnValueFor(OptionalLong.class)).isEmpty();
+        assertThat((OptionalDouble) values.returnValueFor(OptionalDouble.class)).isEmpty();
     }
 
     @Test
-    public void should_return_empty_LongStream() throws Exception {
-        verify_empty_Stream_is_returned("java.util.stream.LongStream");
-    }
-
-    private void verify_empty_Stream_is_returned(String streamFqcn) throws Exception {
-        // given
-        Class<?> streamType = getClassOrSkipTest(streamFqcn);
-
-        // when
-        Object stream = values.returnValueFor(streamType);
-        long count = (Long) streamType.getMethod("count").invoke(stream);
-
-        // then
-        assertEquals("count of empty " + streamFqcn, 0L, count);
-    }
-
-    /**
-     * Tries to load the given class. If the class is not found, the complete test is skipped.
-     */
-    private Class<?> getClassOrSkipTest(String className) {
-        try {
-            return Class.forName(className);
-        } catch (ClassNotFoundException e) {
-            Assume.assumeNoException("JVM does not support " + className, e);
-            return null;
-        }
+    public void should_return_empty_Streams() throws Exception {
+        assertThat((Stream) values.returnValueFor(Stream.class)).isEmpty();
+        assertThat(((DoubleStream) values.returnValueFor(DoubleStream.class)).count()).isEqualTo(0);
+        assertThat(((IntStream) values.returnValueFor(IntStream.class)).count()).isEqualTo(0);
+        assertThat(((LongStream) values.returnValueFor(LongStream.class)).count()).isEqualTo(0);
     }
 
 }
diff --git a/src/test/java/org/mockito/internal/stubbing/defaultanswers/ReturnsMoreEmptyValuesTest.java b/src/test/java/org/mockito/internal/stubbing/defaultanswers/ReturnsMoreEmptyValuesTest.java
index 2725c37df1..6105bde2bd 100644
--- a/src/test/java/org/mockito/internal/stubbing/defaultanswers/ReturnsMoreEmptyValuesTest.java
+++ b/src/test/java/org/mockito/internal/stubbing/defaultanswers/ReturnsMoreEmptyValuesTest.java
@@ -8,21 +8,13 @@
 import org.mockitoutil.TestBase;
 
 import static junit.framework.TestCase.assertEquals;
-import static junit.framework.TestCase.assertTrue;
 
 public class ReturnsMoreEmptyValuesTest extends TestBase {
 
     private ReturnsMoreEmptyValues rv = new ReturnsMoreEmptyValues();
-
-    @Test
-    public void shouldReturnEmptyArray() {
-        String[] ret = (String[]) rv.returnValueFor((new String[0]).getClass());
-        assertTrue(ret.getClass().isArray());
-        assertTrue(ret.length == 0);
-    }
     
     @Test
-    public void shouldReturnEmptyString() {
+    public void should_return_empty_string() {
         assertEquals("", rv.returnValueFor(String.class));
     }
-}
\ No newline at end of file
+}