Merge branch 'master' into master
This commit is contained in:
@@ -8,7 +8,7 @@ public class RemoveLastChar {
|
||||
return (s.substring(0, s.length() - 1));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static String chop(String s) {
|
||||
if (s == null) {
|
||||
return s;
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@ package com.baeldung.stackoverflowerror;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
public class AccountHolderUnitTest {
|
||||
public class AccountHolderManualTest {
|
||||
@Test(expected = StackOverflowError.class)
|
||||
public void whenInstanciatingAccountHolder_thenThrowsException() {
|
||||
AccountHolder holder = new AccountHolder();
|
||||
+1
-2
@@ -1,10 +1,9 @@
|
||||
package com.baeldung.stackoverflowerror;
|
||||
|
||||
import static org.junit.Assert.fail;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
public class CyclicDependancyUnitTest {
|
||||
public class CyclicDependancyManualTest {
|
||||
@Test
|
||||
public void whenInstanciatingClassOne_thenThrowsException() {
|
||||
try {
|
||||
+1
-2
@@ -2,10 +2,9 @@ package com.baeldung.stackoverflowerror;
|
||||
|
||||
import static junit.framework.TestCase.assertEquals;
|
||||
import static org.junit.Assert.fail;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
public class InfiniteRecursionWithTerminationConditionUnitTest {
|
||||
public class InfiniteRecursionWithTerminationConditionManualTest {
|
||||
@Test
|
||||
public void givenPositiveIntNoOne_whenCalcFact_thenThrowsException() {
|
||||
int numToCalcFactorial = 1;
|
||||
+16
-12
@@ -1,29 +1,33 @@
|
||||
package com.baeldung.stackoverflowerror;
|
||||
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
public class UnintendedInfiniteRecursionUnitTest {
|
||||
public class UnintendedInfiniteRecursionManualTest {
|
||||
@Test(expected = StackOverflowError.class)
|
||||
public void givenPositiveIntNoOne_whenCalFact_thenThrowsException() {
|
||||
int numToCalcFactorial = 1;
|
||||
UnintendedInfiniteRecursion uir = new UnintendedInfiniteRecursion();
|
||||
|
||||
int numToCalcFactorial= 1;
|
||||
UnintendedInfiniteRecursion uir
|
||||
= new UnintendedInfiniteRecursion();
|
||||
|
||||
uir.calculateFactorial(numToCalcFactorial);
|
||||
}
|
||||
|
||||
|
||||
@Test(expected = StackOverflowError.class)
|
||||
public void givenPositiveIntGtOne_whenCalcFact_thenThrowsException() {
|
||||
int numToCalcFactorial = 2;
|
||||
UnintendedInfiniteRecursion uir = new UnintendedInfiniteRecursion();
|
||||
|
||||
int numToCalcFactorial= 2;
|
||||
UnintendedInfiniteRecursion uir
|
||||
= new UnintendedInfiniteRecursion();
|
||||
|
||||
uir.calculateFactorial(numToCalcFactorial);
|
||||
}
|
||||
|
||||
|
||||
@Test(expected = StackOverflowError.class)
|
||||
public void givenNegativeInt_whenCalcFact_thenThrowsException() {
|
||||
int numToCalcFactorial = -1;
|
||||
UnintendedInfiniteRecursion uir = new UnintendedInfiniteRecursion();
|
||||
|
||||
int numToCalcFactorial= -1;
|
||||
UnintendedInfiniteRecursion uir
|
||||
= new UnintendedInfiniteRecursion();
|
||||
|
||||
uir.calculateFactorial(numToCalcFactorial);
|
||||
}
|
||||
}
|
||||
@@ -2,7 +2,6 @@ package com.baeldung.string;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotEquals;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.junit.Test;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user