-
-
Save bdeggleston/5622fcf30d31b42619868eacfed647f9 to your computer and use it in GitHub Desktop.
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
/* BMSanityCheckTests.java */ | |
package org.apache.cassandra; | |
import org.junit.Assert; | |
import org.junit.Test; | |
import org.junit.runner.RunWith; | |
import org.jboss.byteman.contrib.bmunit.BMRule; | |
import org.jboss.byteman.contrib.bmunit.BMRules; | |
import org.jboss.byteman.contrib.bmunit.BMUnitConfig; | |
import org.jboss.byteman.contrib.bmunit.BMUnitRunner; | |
@RunWith(BMUnitRunner.class) | |
public class BMSanityCheckTest | |
{ | |
@Test | |
@BMUnitConfig(debug = true, verbose = true, bmunitVerbose = true) | |
@BMRules(rules = {@BMRule (name="rule", | |
targetClass = "org.apache.cassandra.BMSanityHelper", | |
targetMethod = "doSomething", | |
targetLocation = "AT ENTRY", | |
action = "org.apache.cassandra.BMSanityHelper.ack()" )}) | |
public void name() | |
{ | |
BMSanityHelper helper = new BMSanityHelper(); | |
Assert.assertFalse(helper.wasAcked); | |
helper.doSomething(); | |
Assert.assertTrue(helper.wasAcked); | |
} | |
} | |
/* BMSanityHelper.java */ | |
package org.apache.cassandra; | |
public class BMSanityHelper | |
{ | |
static boolean wasAcked = false; | |
static void ack() | |
{ | |
System.out.println("ack"); | |
wasAcked = true; | |
} | |
void doSomething() | |
{ | |
System.out.println("something"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment