Skip to content
/ bomb Public

Bomb is an utility that allows you to mark method as inaccessible.

License

Notifications You must be signed in to change notification settings

waabox/bomb

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Bomb

What is this?

Bomb is an utility that allows you to mark method as innacesible.

Ok, why?

Because sometimes, you need to use an object and then by its signature you need to 'loose it controls' so, in order to avoid you to wrap the object, etc etc, you can 'Bomb.it' and expect the UnitTest cover your ass instead of the Production Environment :D

Ok, I'm crazy enough...Tell me how!

In this example, you will create a simple java.lang.Object and then, we'll bomb it's hashCode method.

  public class Foo {

    public static void main(String[] args) {
      Bomb<Object> bomb = new Bomb<Object>(new Object());
      bomb.detonator("hash");
      Object bombed = bomb.get();
      // ok, lets bomb it! Hadouuuken!
      bombed.hashCode();
    }
  
  }

Once we execute this program, a org.waabox.bomb.BombException will be raised! :D

You will find a better example in: https://github.com/waabox/bomb/blob/master/src/test/java/org/waabox/bomb/BombTest.java

Maven repository

You can find bomb within the maven central =D

<dependency>
  <groupId>org.waabox</groupId>
  <artifactId>bomb</artifactId>
  <version>1.1</version>
</dependency>

happy coding!

About

Bomb is an utility that allows you to mark method as inaccessible.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages