View parameterized_test_example_1.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public LoanResponse requestLoan(float loanAmount, float downPayment, float availableFunds) | |
{ | |
LoanResponse response = new LoanResponse(); | |
response.setApproved(true); | |
if (availableFunds < downPayment) { | |
response.setApproved(false); | |
response.setMessage("error.insufficient.funds.for.down.payment"); | |
return response; | |
} |
View parameterized_test_example_2.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Test | |
public void testRequestLoan() throws Throwable | |
{ | |
// Given | |
LoanProcessor underTest = new LoanProcessor(); | |
// When | |
LoanResponse result = underTest.requestLoan(1000f, 200f, 250f); | |
// Then |
View parameterized_test_example_3.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@RunWith(Parameterized.class) | |
public class LoanProcessorParameterizedTest { | |
float loanAmount; | |
float downPayment; | |
float availableFunds; | |
boolean expectApproved; | |
String expectedMessage; | |
public LoanProcessorParameterizedTest(float loanAmount, float downPayment, |
View parameterized_test_example_4.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Parameters(name = "Run {index}: loanAmount={0}, downPayment={1}, availableFunds={2}, expectApproved={3}, expectedMessage={4}") | |
public static Iterable<Object[]> data() throws Throwable | |
{ | |
return Arrays.asList(new Object[][] { | |
{ 1000.0f, 200.0f, 250.0f, true, null } | |
}); | |
} |
View parameterized_test_example_5.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Parameters(name = "Run {index}: loanAmount={0}, downPayment={1}, availableFunds={2}, expectApproved={3}, expectedMessage={4}") | |
public static Iterable<Object[]> data() throws Throwable | |
{ | |
return Arrays.asList(new Object[][] { | |
{ 1000.0f, 200.0f, 250.0f, true, null }, | |
{ 1000.0f, 50.0f, 250.0f, false, "error.insufficient.down.payment" }, | |
{ 1000.0f, 200.0f, 150.0f, false, "error.insufficient.funds.for.down.payment" } | |
}); | |
} |
View parameterized_test_example_6.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Test | |
public void testRequestLoan() throws Throwable | |
{ | |
// Given | |
LoanProcessor underTest = new LoanProcessor(); | |
// When | |
LoanResponse result = underTest.requestLoan(loanAmount, downPayment, availableFunds); | |
// Then |
View parameterized_test_example_7.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@RunWith(JUnitParamsRunner.class) | |
public class LoanProcessorParameterizedTest2 { | |
@Test | |
@Parameters(method = "testRequestLoan_Parameters") | |
public void testRequestLoan(float loanAmount, float downPayment, float availableFunds, | |
boolean expectApproved, String expectedMessage) throws Throwable | |
{ | |
... | |
} |
View parameterized_test_example_8.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class LoanProcessorParameterizedTest { | |
@ParameterizedTest(name="Run {index}: loanAmount={0}, downPayment={1}, availableFunds={2}, expectApproved={3}, expectedMessage={4}") | |
@MethodSource("testRequestLoan_Parameters") | |
public void testRequestLoan(float loanAmount, float downPayment, float availableFunds, | |
boolean expectApproved, String expectedMessage) throws Throwable | |
{ | |
... | |
} |
View Insure++_Heartbleed_5.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
OPENSSL_PATH=’/home/USER/heartbleed/env’ | |
INSURE_PATH=’/home/USER/insure’ | |
MY_LIBS=’-linsure -linsure_mt -ldl’ | |
MY_LIB_PATHS="-L${OPENSSL_PATH}/lib -L${INSURE_PATH}/lib" | |
MY_LD_LIB_PATHS="${OPENSSL_PATH}/lib:${INSURE_PATH}/lib" | |
MY_FLAGS="$MY_LIB_PATHS $MY_LIBS" | |
CC="$(command -v gcc)" \ | |
CXX="$(command -v g++)" \ |
View Insure++_Heartbleed_7.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<title>Heartbleed Demo</title> | |
</head> | |
<body> | |
<h1>Hello world!</h1> | |
</body> | |
</html> |
OlderNewer