DataProviderFrameworkMethod extends FrameworkMethod { @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (!super.equals(obj)) { return false; } if (getClass() != obj.getClass()) { return false; } DataProviderFrameworkMethod other = (DataProviderFrameworkMethod) obj; if (idx != other.idx) { return false; } if (nameFormat == null) { if (other.nameFormat != null) { return false; } } else if (!nameFormat.equals(other.nameFormat)) { return false; } if (!Arrays.equals(parameters, other.parameters)) { return false; } return true; } DataProviderFrameworkMethod(Method method, int idx, Object[] parameters, String nameFormat);  DataProviderFrameworkMethod(Method method, int idx, Object[] parameters,
            String nameFormat, Class<? extends DataProviderTestNameFormatter> nameFormatter); @Override String getName(); @Override Object invokeExplosively(Object target, Object... params); @Override int hashCode(); @Override boolean equals(Object obj);  }
@Test public void testEqualsShouldReturnTrueForSameObject() { final Object[] params = new Object[] { 1, 1.0 }; DataProviderFrameworkMethod m = new DataProviderFrameworkMethod(method, 70, params, "%p[70]"); boolean result = m.equals(m); assertThat(result).isTrue(); }
@Test public void testEqualsShouldReturnTrueForEqualObjects() { final Object[] params1 = new Object[] { "str", 3, true }; final Object[] params2 = new Object[] { "str", 3, true }; DataProviderFrameworkMethod m1 = new DataProviderFrameworkMethod(method, 71, params1, "%p[71]"); DataProviderFrameworkMethod m2 = new DataProviderFrameworkMethod(method, 71, params2, "%p[71]"); boolean result = m1.equals(m2); assertThat(result).isTrue(); }
@Test public void testEqualsShouldReturnFalseForUnequalIndices() { final Object[] params1 = new Object[] { null, 'a', false }; final Object[] params2 = new Object[] { null, 'a', false }; DataProviderFrameworkMethod m1 = new DataProviderFrameworkMethod(method, 81, params1, "%p[81]"); DataProviderFrameworkMethod m2 = new DataProviderFrameworkMethod(method, 82, params2, "%p[82]"); boolean result = m1.equals(m2); assertThat(result).isFalse(); }
@Test public void testEqualsShouldReturnFalseForUnequalParamValues() { final Object[] params1 = new Object[] { "test", 4L, true }; final Object[] params2 = new Object[] { "test", 5L, false }; DataProviderFrameworkMethod m1 = new DataProviderFrameworkMethod(method, 83, params1, "%p[83]"); DataProviderFrameworkMethod m2 = new DataProviderFrameworkMethod(method, 83, params2, "%p[83]"); boolean result = m1.equals(m2); assertThat(result).isFalse(); }
@Test public void testEqualsShouldReturnFalseForUnequalParamTypes() { final Object[] params1 = new Object[] { 1, 22L, 333 }; final Object[] params2 = new Object[] { "1", 22, 333L }; DataProviderFrameworkMethod m1 = new DataProviderFrameworkMethod(method, 84, params1, "%p[84]"); DataProviderFrameworkMethod m2 = new DataProviderFrameworkMethod(method, 84, params2, "%p[84]"); boolean result = m1.equals(m2); assertThat(result).isFalse(); }