use of org.junit.contrib.java.lang.system.Assertion in project YCSB by brianfrankcooper.
the class IntegrationTest method testReadOpsBenchmarkFailure.
//All read operations during benchmark are executed with an HTTP 500 error.
@Test
public void testReadOpsBenchmarkFailure() throws InterruptedException {
exit.expectSystemExit();
exit.checkAssertionAfterwards(new Assertion() {
@Override
public void checkAssertion() throws Exception {
List<String> results = Utils.read(RESULTS_FILEPATH);
assertEquals(true, results.contains("[READ], Return=ERROR, 1"));
Utils.delete(RESULTS_FILEPATH);
}
});
Client.main(getArgs(ERROR_TRACE_FILEPATH, 1, 0, 0, 0));
}
use of org.junit.contrib.java.lang.system.Assertion in project YCSB by brianfrankcooper.
the class IntegrationTest method testUpdateOpsBenchmarkSuccess.
//All update operations during benchmark are executed successfully with an HTTP OK status.
@Test
public void testUpdateOpsBenchmarkSuccess() throws InterruptedException {
exit.expectSystemExit();
exit.checkAssertionAfterwards(new Assertion() {
@Override
public void checkAssertion() throws Exception {
List<String> results = Utils.read(RESULTS_FILEPATH);
assertEquals(true, results.contains("[UPDATE], Return=OK, 1"));
Utils.delete(RESULTS_FILEPATH);
}
});
Client.main(getArgs(TRACE_FILEPATH, 0, 0, 1, 0));
}
use of org.junit.contrib.java.lang.system.Assertion in project YCSB by brianfrankcooper.
the class IntegrationTest method testInsertOpsBenchmarkSuccess.
//All insert operations during benchmark are executed successfully with an HTTP OK status.
@Test
public void testInsertOpsBenchmarkSuccess() throws InterruptedException {
exit.expectSystemExit();
exit.checkAssertionAfterwards(new Assertion() {
@Override
public void checkAssertion() throws Exception {
List<String> results = Utils.read(RESULTS_FILEPATH);
assertEquals(true, results.contains("[INSERT], Return=OK, 1"));
Utils.delete(RESULTS_FILEPATH);
}
});
Client.main(getArgs(TRACE_FILEPATH, 0, 1, 0, 0));
}
use of org.junit.contrib.java.lang.system.Assertion in project checkstyle by checkstyle.
the class MainTest method testExistingDirectoryWithViolations.
@Test
public void testExistingDirectoryWithViolations() throws Exception {
// we just reference there all violations
final String[][] outputValues = { { "InputComplexityOverflow", "1", "172" } };
final int allowedLength = 170;
final String msgKey = "maxLen.file";
final String bundle = "com.puppycrawl.tools.checkstyle.checks.sizes.messages";
exit.checkAssertionAfterwards(new Assertion() {
@Override
public void checkAssertion() throws IOException {
final String expectedPath = getFilePath("checks/metrics") + File.separator;
final StringBuilder sb = new StringBuilder();
sb.append("Starting audit...").append(System.getProperty("line.separator"));
final String format = "[WARN] %s.java:%s: %s [FileLength]";
for (String[] outputValue : outputValues) {
final String localizedMessage = new LocalizedMessage(0, bundle, msgKey, new Integer[] { Integer.valueOf(outputValue[2]), allowedLength }, null, getClass(), null).getMessage();
final String line = String.format(Locale.ROOT, format, expectedPath + outputValue[0], outputValue[1], localizedMessage);
sb.append(line).append(System.getProperty("line.separator"));
}
sb.append("Audit done.").append(System.getProperty("line.separator"));
assertEquals(sb.toString(), systemOut.getLog());
assertEquals("", systemErr.getLog());
}
});
Main.main("-c", getPath("config-filelength.xml"), getPath("checks/metrics"));
}
Aggregations