Removing try-catch from tests and minor formatting (#1840)
* BAEL-876 - Remove try-catch * BAEL-876 - Remove try - catch * formatting
This commit is contained in:
parent
e5cccec42e
commit
44b0f6b02c
|
@ -4,13 +4,8 @@ import static org.junit.Assert.fail;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
public class CyclicDependancyManualTest {
|
public class CyclicDependancyManualTest {
|
||||||
@Test
|
@Test(expected = StackOverflowError.class)
|
||||||
public void whenInstanciatingClassOne_thenThrowsException() {
|
public void whenInstanciatingClassOne_thenThrowsException() {
|
||||||
try {
|
|
||||||
ClassOne obj = new ClassOne();
|
ClassOne obj = new ClassOne();
|
||||||
fail();
|
|
||||||
} catch (StackOverflowError soe) {
|
|
||||||
soe.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,16 +21,11 @@ public class InfiniteRecursionWithTerminationConditionManualTest {
|
||||||
assertEquals(120, irtc.calculateFactorial(numToCalcFactorial));
|
assertEquals(120, irtc.calculateFactorial(numToCalcFactorial));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test(expected = StackOverflowError.class)
|
||||||
public void givenNegativeInt_whenCalcFact_thenThrowsException() {
|
public void givenNegativeInt_whenCalcFact_thenThrowsException() {
|
||||||
try {
|
|
||||||
int numToCalcFactorial = -1;
|
int numToCalcFactorial = -1;
|
||||||
InfiniteRecursionWithTerminationCondition irtc = new InfiniteRecursionWithTerminationCondition();
|
InfiniteRecursionWithTerminationCondition irtc = new InfiniteRecursionWithTerminationCondition();
|
||||||
|
|
||||||
irtc.calculateFactorial(numToCalcFactorial);
|
irtc.calculateFactorial(numToCalcFactorial);
|
||||||
fail();
|
|
||||||
} catch (StackOverflowError soe) {
|
|
||||||
soe.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,8 +7,7 @@ public class UnintendedInfiniteRecursionManualTest {
|
||||||
@Test(expected = StackOverflowError.class)
|
@Test(expected = StackOverflowError.class)
|
||||||
public void givenPositiveIntNoOne_whenCalFact_thenThrowsException() {
|
public void givenPositiveIntNoOne_whenCalFact_thenThrowsException() {
|
||||||
int numToCalcFactorial= 1;
|
int numToCalcFactorial= 1;
|
||||||
UnintendedInfiniteRecursion uir
|
UnintendedInfiniteRecursion uir = new UnintendedInfiniteRecursion();
|
||||||
= new UnintendedInfiniteRecursion();
|
|
||||||
|
|
||||||
uir.calculateFactorial(numToCalcFactorial);
|
uir.calculateFactorial(numToCalcFactorial);
|
||||||
}
|
}
|
||||||
|
@ -16,8 +15,7 @@ public class UnintendedInfiniteRecursionManualTest {
|
||||||
@Test(expected = StackOverflowError.class)
|
@Test(expected = StackOverflowError.class)
|
||||||
public void givenPositiveIntGtOne_whenCalcFact_thenThrowsException() {
|
public void givenPositiveIntGtOne_whenCalcFact_thenThrowsException() {
|
||||||
int numToCalcFactorial= 2;
|
int numToCalcFactorial= 2;
|
||||||
UnintendedInfiniteRecursion uir
|
UnintendedInfiniteRecursion uir = new UnintendedInfiniteRecursion();
|
||||||
= new UnintendedInfiniteRecursion();
|
|
||||||
|
|
||||||
uir.calculateFactorial(numToCalcFactorial);
|
uir.calculateFactorial(numToCalcFactorial);
|
||||||
}
|
}
|
||||||
|
@ -25,8 +23,7 @@ public class UnintendedInfiniteRecursionManualTest {
|
||||||
@Test(expected = StackOverflowError.class)
|
@Test(expected = StackOverflowError.class)
|
||||||
public void givenNegativeInt_whenCalcFact_thenThrowsException() {
|
public void givenNegativeInt_whenCalcFact_thenThrowsException() {
|
||||||
int numToCalcFactorial= -1;
|
int numToCalcFactorial= -1;
|
||||||
UnintendedInfiniteRecursion uir
|
UnintendedInfiniteRecursion uir = new UnintendedInfiniteRecursion();
|
||||||
= new UnintendedInfiniteRecursion();
|
|
||||||
|
|
||||||
uir.calculateFactorial(numToCalcFactorial);
|
uir.calculateFactorial(numToCalcFactorial);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue