Last active
December 26, 2015 04:08
-
-
Save eleco/7090459 to your computer and use it in GitHub Desktop.
log exception
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
package com.company; | |
import java.util.logging.Level; | |
import java.util.logging.Logger; | |
public class Item { | |
Logger log = Logger.getLogger("ItemLogger"); | |
public boolean function(String param) { | |
if (param==null) { | |
log.log(Level.SEVERE,"error", new IllegalArgumentException("boom")); | |
return false; | |
} | |
return true; | |
} | |
} |
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
package com.company; | |
import org.junit.Test; | |
import static org.hamcrest.CoreMatchers.is; | |
import static org.junit.Assert.assertThat; | |
public class ItemTest { | |
@Test | |
public void testFunction() { | |
assertThat(new Item().function(null),is(false)); | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment