Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 0 additions & 47 deletions org.moreunit.core.test/src/org/moreunit/core/util/IOUtilsTest.java

This file was deleted.

50 changes: 0 additions & 50 deletions org.moreunit.core.test/src/org/moreunit/core/util/ObjectsTest.java

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,41 @@ public void closeQuietly_should_swallow_IOExceptions() throws Exception

// then: no exception = success
}

@Test
public void closeQuietly_should_ignore_null_array() throws Exception
{
// when
closeQuietly((Closeable[]) null);

// then: no exception = success
}

@Test
public void closeQuietly_should_ignore_null_varargs_elements() throws Exception
{
// when
closeQuietly(null, null);

// then: no exception = success
}

@Test
public void closeQuietly_should_continue_closing_remaining_resources_on_exception() throws Exception
{
// given
Closeable c1 = mock(Closeable.class);
Closeable c2 = mock(Closeable.class);
Closeable c3 = mock(Closeable.class);

doThrow(new IOException()).when(c2).close();

// when
closeQuietly(c1, c2, c3);

// then
verify(c1, times(1)).close();
verify(c2, times(1)).close();
verify(c3, times(1)).close();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,20 @@ public void unequal_objects_should_be_seen_as_such() throws Exception
assertFalse(Objects.equal("abc", "aBc"));
assertFalse(Objects.equal(95, 94));
}

@Test
public void testHash() {
org.junit.jupiter.api.Assertions.assertEquals(
java.util.Arrays.hashCode(new Object[]{"a", "b"}),
Objects.hash("a", "b")
);
org.junit.jupiter.api.Assertions.assertEquals(
java.util.Arrays.hashCode(new Object[]{null, "b"}),
Objects.hash(null, "b")
);
org.junit.jupiter.api.Assertions.assertEquals(
java.util.Arrays.hashCode(new Object[]{}),
Objects.hash()
);
}
}
33 changes: 33 additions & 0 deletions patch_objects.diff
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<<<<<<< SEARCH
@Test
public void unequal_objects_should_be_seen_as_such() throws Exception
{
assertFalse(Objects.equal("abc", "aBc"));
assertFalse(Objects.equal(95, 94));
}
}
=======
@Test
public void unequal_objects_should_be_seen_as_such() throws Exception
{
assertFalse(Objects.equal("abc", "aBc"));
assertFalse(Objects.equal(95, 94));
}

@Test
public void testHash() {
org.junit.jupiter.api.Assertions.assertEquals(
java.util.Arrays.hashCode(new Object[]{"a", "b"}),
Objects.hash("a", "b")
);
org.junit.jupiter.api.Assertions.assertEquals(
java.util.Arrays.hashCode(new Object[]{null, "b"}),
Objects.hash(null, "b")
);
org.junit.jupiter.api.Assertions.assertEquals(
java.util.Arrays.hashCode(new Object[]{}),
Objects.hash()
);
}
}
>>>>>>> REPLACE
Loading