1 58 package org.krysalis.barcode.cli; 59 60 65 public class ExitHandlerForTests extends AbstractExitHandler { 66 67 private String lastMsg; 68 private Throwable lastThrowable; 69 private int lastExitCode = 0; 70 71 public void reset() { 72 this.lastMsg = null; 73 this.lastThrowable = null; 74 this.lastExitCode = 0; 75 } 76 77 81 public int getLastExitCode() { 82 return lastExitCode; 83 } 84 85 89 public String getLastMsg() { 90 return lastMsg; 91 } 92 93 97 public Throwable getLastThrowable() { 98 return lastThrowable; 99 } 100 101 102 public void failureExit(Main app, String msg, Throwable t, int exitCode) { 103 super.failureExit(app, msg, t, exitCode); 104 this.lastMsg = msg; 105 this.lastThrowable = t; 106 this.lastExitCode = exitCode; 107 throw new SimulateVMExitError(); 108 } 109 110 111 public void successfulExit(Main app) { 112 super.successfulExit(app); 113 this.lastMsg = null; 114 this.lastThrowable = null; 115 this.lastExitCode = 0; 116 throw new SimulateVMExitError(); 117 } 118 119 } 120 | Popular Tags |