1 50 51 52 53 package net.sf.just4log; 54 55 import net.sf.just4log.transform.Transform; 56 57 61 62 public class ExitTest extends JustLog1Test { 63 64 public String after; 65 66 69 public ExitTest(String arg0) { 70 super(arg0); 71 } 72 73 protected void setUp() throws Exception { 74 Transform.level_enters = Transform.NOENTER; 75 Transform.level_exits = Transform.SIMPLEEXIT; 76 setBefore("/*\n"+ 77 " * Created on 23 juin 2003\n"+ 78 " *\n"+ 79 " */\n"+ 80 "package net.sf.just4log;\n"+ 81 "\n"+ 82 "import org.apache.commons.logging.Log;\n"+ 83 "import org.apache.commons.logging.LogFactory;\n"+ 84 "\n"+ 85 "/**\n"+ 86 " * @author Lucas Bruand\n"+ 87 " */\n"+ 88 "\n"+ 89 "public class SimpleClass {\n"+ 90 " private static Log logger = LogFactory.getLog(SimpleClass.class);\n"+ 91 " public int sum(int a, int b) {\n"+ 92 " if ((a>0) && (b>0)) {\n"+ 93 " int result = a+b;\n"+ 94 " logger.debug(\"Sum(\"+a+\",\"+b+\")=\"+result);\n"+ 95 " return a+b;\n"+ 96 " }\n"+ 97 " return 0;\n"+ 98 " }\n"+ 99 "}"); 100 setAfter("/*\n"+ 101 " * Created on 23 juin 2003\n"+ 102 " *\n"+ 103 " */\n"+ 104 "package net.sf.just4log;\n"+ 105 "\n"+ 106 "import org.apache.commons.logging.Log;\n"+ 107 "import org.apache.commons.logging.LogFactory;\n"+ 108 "\n"+ 109 "/**\n"+ 110 " * @author Lucas Bruand\n"+ 111 " */\n"+ 112 "\n"+ 113 "public class SimpleClass {\n"+ 114 " private static Log logger = LogFactory.getLog(SimpleClass.class);\n"+ 115 " public int sum(int a, int b) {\n"+ 116 " if ((a>0) && (b>0)) {\n"+ 117 " int result = a+b;\n"+ 118 " if (logger.isDebugEnabled()) {"+ 119 " logger.debug(\"Sum(\"+a+\",\"+b+\")=\"+result);\n"+ 120 " }"+ 121 " if (logger.isTraceEnabled()) {"+ 122 " logger.trace(\"exits: int sum(int, int)\");\n"+ 123 " }"+ 124 " return a+b;\n"+ 125 " }\n"+ 126 " if (logger.isTraceEnabled()) {"+ 127 " logger.trace(\"exits: int sum(int, int)\");\n"+ 128 " }"+ 129 " return 0;\n"+ 130 " }\n"+ 131 "}"); 132 } 133 134 137 protected void tearDown() throws Exception { 138 super.tearDown(); 139 Transform.level_enters = Transform.NOENTER; 140 Transform.level_exits = Transform.NOEXIT; 141 } 142 143 } 144 | Popular Tags |