small fixes
This commit is contained in:
-13
@@ -28,17 +28,4 @@ public class AppManagerUnitTest {
|
||||
|
||||
Assertions.assertFalse(appManager.managerResponse("Why are you coming late?"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void givenAppManager_whenPrivateStaticMethod_thenValidateExpectedResponse() {
|
||||
final int response = Deencapsulation.invoke(AppManager.class, "stringToInteger", "110");
|
||||
Assertions.assertEquals(110, response);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void givenAppManager_whenPrivateStaticMethod_thenExpectException() {
|
||||
Assertions.assertThrows(IllegalArgumentException.class, () -> {
|
||||
Deencapsulation.invoke(AppManager.class, "stringToInteger", "11r");
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
-20
@@ -1,12 +1,10 @@
|
||||
package org.baeldung.mocks.jmockit;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.baeldung.mocks.jmockit.AdvancedCollaborator.InnerAdvancedCollaborator;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
@@ -52,12 +50,6 @@ public class AdvancedCollaboratorIntegrationTest<MultiMock extends List<String>
|
||||
assertEquals(1, coll.i);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testToCallPrivateMethodsDirectly() {
|
||||
Object value = Deencapsulation.invoke(mock, "privateMethod");
|
||||
assertEquals("default:", value);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testToSetPrivateFieldDirectly() {
|
||||
Deencapsulation.setField(mock, "privateField", 10);
|
||||
@@ -70,18 +62,6 @@ public class AdvancedCollaboratorIntegrationTest<MultiMock extends List<String>
|
||||
assertEquals(5, value);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testToCreateNewInstanceDirectly() {
|
||||
AdvancedCollaborator coll = Deencapsulation.newInstance(AdvancedCollaborator.class, "foo");
|
||||
assertEquals(3, coll.i);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testToCreateNewInnerClassInstanceDirectly() {
|
||||
InnerAdvancedCollaborator innerCollaborator = Deencapsulation.newInnerInstance(InnerAdvancedCollaborator.class, mock);
|
||||
assertNotNull(innerCollaborator);
|
||||
}
|
||||
|
||||
@Test
|
||||
@SuppressWarnings("unchecked")
|
||||
public void testMultipleInterfacesWholeTest() {
|
||||
|
||||
+1
-2
@@ -3,7 +3,6 @@ package org.baeldung.mocks.jmockit;
|
||||
import mockit.Delegate;
|
||||
import mockit.Expectations;
|
||||
import mockit.Mocked;
|
||||
import mockit.StrictExpectations;
|
||||
import mockit.Verifications;
|
||||
import mockit.integration.junit4.JMockit;
|
||||
import org.hamcrest.BaseMatcher;
|
||||
@@ -106,7 +105,7 @@ public class ExpectationsIntegrationTest {
|
||||
|
||||
@Test
|
||||
public void testResultAndReturns(@Mocked ExpectationsCollaborator mock) {
|
||||
new StrictExpectations() {{
|
||||
new Expectations() {{
|
||||
mock.methodReturnsString();
|
||||
result = "foo";
|
||||
result = new Exception();
|
||||
|
||||
Reference in New Issue
Block a user