commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject svn commit: r1697254 - in /commons/proper/bcel/trunk/src/test/java/org/apache/commons/bcel6/generic: BranchHandleTestCase.java InstructionHandleTestCase.java
Date Sun, 23 Aug 2015 20:58:41 GMT
Author: sebb
Date: Sun Aug 23 20:58:41 2015
New Revision: 1697254

URL: http://svn.apache.org/r1697254
Log:
Start some tests for InstructionHandle/BranchHandle

Added:
    commons/proper/bcel/trunk/src/test/java/org/apache/commons/bcel6/generic/BranchHandleTestCase.java
  (with props)
    commons/proper/bcel/trunk/src/test/java/org/apache/commons/bcel6/generic/InstructionHandleTestCase.java
  (with props)

Added: commons/proper/bcel/trunk/src/test/java/org/apache/commons/bcel6/generic/BranchHandleTestCase.java
URL: http://svn.apache.org/viewvc/commons/proper/bcel/trunk/src/test/java/org/apache/commons/bcel6/generic/BranchHandleTestCase.java?rev=1697254&view=auto
==============================================================================
--- commons/proper/bcel/trunk/src/test/java/org/apache/commons/bcel6/generic/BranchHandleTestCase.java
(added)
+++ commons/proper/bcel/trunk/src/test/java/org/apache/commons/bcel6/generic/BranchHandleTestCase.java
Sun Aug 23 20:58:41 2015
@@ -0,0 +1,37 @@
+package org.apache.commons.bcel6.generic;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+public class BranchHandleTestCase {
+
+    // Test that setInstruction only allows BranchInstructions
+    @Test(expected=ClassGenException.class)
+    public void testsetInstructionNull() {
+        BranchHandle bh = BranchHandle.getBranchHandle(new GOTO(null));// have to start with
a valid BI
+        Assert.assertNotNull(bh);
+        bh.setInstruction(null);
+        Assert.assertNotNull(bh);
+    }
+
+    @Test
+    public void testsetInstructionBI() {
+        BranchHandle bh = BranchHandle.getBranchHandle(new GOTO(null));// have to start with
a valid BI
+        Assert.assertNotNull(bh);
+        bh.setInstruction(new GOTO(null));        
+        Assert.assertNotNull(bh);
+    }
+
+    @Test(expected=ClassGenException.class)
+    public void testsetInstructionnotBI() {
+        BranchHandle bh = BranchHandle.getBranchHandle(new GOTO(null));// have to start with
a valid BI
+        Assert.assertNotNull(bh);
+        bh.setInstruction(new NOP());        
+        Assert.assertNotNull(bh);
+    }
+
+    @Test(expected=ClassGenException.class)
+    public void testGetBHnull() {
+        BranchHandle.getBranchHandle(null); 
+    }
+}

Propchange: commons/proper/bcel/trunk/src/test/java/org/apache/commons/bcel6/generic/BranchHandleTestCase.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: commons/proper/bcel/trunk/src/test/java/org/apache/commons/bcel6/generic/InstructionHandleTestCase.java
URL: http://svn.apache.org/viewvc/commons/proper/bcel/trunk/src/test/java/org/apache/commons/bcel6/generic/InstructionHandleTestCase.java?rev=1697254&view=auto
==============================================================================
--- commons/proper/bcel/trunk/src/test/java/org/apache/commons/bcel6/generic/InstructionHandleTestCase.java
(added)
+++ commons/proper/bcel/trunk/src/test/java/org/apache/commons/bcel6/generic/InstructionHandleTestCase.java
Sun Aug 23 20:58:41 2015
@@ -0,0 +1,38 @@
+package org.apache.commons.bcel6.generic;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+public class InstructionHandleTestCase {
+
+    // Test that setInstruction only allows Instructions that are not BranchInstructions
+
+    @Test(expected=ClassGenException.class)
+    public void testsetInstructionNull() {
+        InstructionHandle ih = InstructionHandle.getInstructionHandle(new NOP());// have
to start with a valid non BI
+        Assert.assertNotNull(ih);
+        ih.setInstruction(null);
+        Assert.assertNotNull(ih);
+    }
+
+    @Test
+    public void testsetInstructionI() {
+        InstructionHandle ih = InstructionHandle.getInstructionHandle(new NOP());// have
to start with a valid non BI
+        Assert.assertNotNull(ih);
+        ih.setInstruction(new NOP());        
+        Assert.assertNotNull(ih);
+    }
+
+    @Test(expected=ClassGenException.class)
+    public void testsetInstructionnotI() {
+        InstructionHandle ih = InstructionHandle.getInstructionHandle(new NOP());// have
to start with a valid non BI
+        Assert.assertNotNull(ih);
+        ih.setInstruction(new GOTO(null));        
+        Assert.assertNotNull(ih);
+    }
+
+    @Test(expected=ClassGenException.class)
+    public void testGetIHnull() {
+        InstructionHandle.getInstructionHandle(null); 
+    }
+}

Propchange: commons/proper/bcel/trunk/src/test/java/org/apache/commons/bcel6/generic/InstructionHandleTestCase.java
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message