Example usage for org.springframework.batch.core.step.tasklet SystemCommandException getMessage

List of usage examples for org.springframework.batch.core.step.tasklet SystemCommandException getMessage

Introduction

In this page you can find the example usage for org.springframework.batch.core.step.tasklet SystemCommandException getMessage.

Prototype

public String getMessage() 

Source Link

Document

Returns the detail message string of this throwable.

Usage

From source file:org.springframework.batch.core.step.tasklet.SystemCommandTaskletIntegrationTests.java

@Test
public void testExecuteTimeout() throws Exception {
    String command = System.getProperty("os.name").toLowerCase().contains("win") ? "ping 1.1.1.1 -n 1 -w 3000"
            : "sleep 3";
    tasklet.setCommand(command);//from www  . j  ava  2  s  .c  o  m
    tasklet.setTimeout(10);
    tasklet.afterPropertiesSet();

    log.info("Executing command: " + command);
    try {
        tasklet.execute(null, null);
        fail();
    } catch (SystemCommandException e) {
        assertTrue(e.getMessage().contains("did not finish within the timeout"));
    }
}