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
37 changes: 37 additions & 0 deletions org.moreunit.test/test/org/moreunit/util/BaseToolsTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.junit.jupiter.api.Assertions.assertNull;

import java.util.ArrayList;
import java.util.Arrays;
Expand Down Expand Up @@ -139,4 +140,40 @@ public void getListOfUnqualifiedTypeNames_should_return_list_sorted_by_raw_lengt
assertEquals(result.get(1), "OneTwoThree");
assertEquals(result.get(5), "One");
}

@Test
public void getFirstMethodWithSameNamePrefix_should_return_null_when_methodName_is_null() {
org.eclipse.jdt.core.IMethod[] methods = new org.eclipse.jdt.core.IMethod[0];
assertNull(BaseTools.getFirstMethodWithSameNamePrefix(methods, null));
}

@Test
public void getFirstMethodWithSameNamePrefix_should_return_null_when_no_method_matches() {
org.eclipse.jdt.core.IMethod method1 = org.mockito.Mockito.mock(org.eclipse.jdt.core.IMethod.class);
org.mockito.Mockito.when(method1.getElementName()).thenReturn("foo");
org.mockito.Mockito.when(method1.exists()).thenReturn(true);

org.eclipse.jdt.core.IMethod[] methods = { method1 };
assertNull(BaseTools.getFirstMethodWithSameNamePrefix(methods, "bar"));
}

@Test
public void getFirstMethodWithSameNamePrefix_should_return_matching_method() {
org.eclipse.jdt.core.IMethod method1 = org.mockito.Mockito.mock(org.eclipse.jdt.core.IMethod.class);
org.mockito.Mockito.when(method1.getElementName()).thenReturn("foo");
org.mockito.Mockito.when(method1.exists()).thenReturn(true);

org.eclipse.jdt.core.IMethod[] methods = { method1 };
assertEquals(method1, BaseTools.getFirstMethodWithSameNamePrefix(methods, "fooBar"));
}

@Test
public void getFirstMethodWithSameNamePrefix_should_not_return_method_that_does_not_exist() {
org.eclipse.jdt.core.IMethod method1 = org.mockito.Mockito.mock(org.eclipse.jdt.core.IMethod.class);
org.mockito.Mockito.when(method1.getElementName()).thenReturn("foo");
org.mockito.Mockito.when(method1.exists()).thenReturn(false);

org.eclipse.jdt.core.IMethod[] methods = { method1 };
assertNull(BaseTools.getFirstMethodWithSameNamePrefix(methods, "fooBar"));
}
}
33 changes: 0 additions & 33 deletions patch_objects.diff

This file was deleted.

1 change: 0 additions & 1 deletion test_check.sh

This file was deleted.

1 change: 0 additions & 1 deletion test_diviner.sh

This file was deleted.

Loading