I create a BitSet of length 3 and clear the first two positions and set the last one. My debug output of the BitSet is expected to be something like {0, 0, 1}. But actually is {2}.
Implemented complete mvn project with JUnit 4.11 supporting Testcase.
package org.no_ip.leder.test;
import static org.junit.Assert.assertEquals;
import org.junit.BeforeClass;
import org.junit.Test;
import java.util.BitSet;
public class TestCase1 {
@BeforeClass
public static void setUpClass() {
System.out.println("TestCase1 setup");
}
@Test
public void test1() {
BitSet ex_result = new BitSet(3);
BitSet test = new BitSet(3);
App app = new App();
test = app.createFromString("100");
ex_result.clear(0);
ex_result.clear(1);
ex_result.set(2);
//DEBUG:
System.out.println(ex_result);
System.out.println(test);
assertEquals("app.createFromString(\"100\"): ", ex_result, test);
}
}
------------------------Output:
-------------------------------------------------------
T E S T S
-------------------------------------------------------
Running org.no_ip.leder.test.TestSuite1
TestCase1 setup
{2}
{2}
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.231 sec
What is a Boolean BitSet representing with value of "2"?