I came across something strange. Example of function:
public class F {
public enum Pawn {Black, White}
public Pawn x;
public F(){
this.x = Pawn.Black;
}
public Pawn test(){
return this.x;
}
}
Unit test for this:
import junit.framework.Assert;
import junit.framework.TestCase;
import <package ... >.F;
public class FTest extends TestCase {
public void testValue(){
F mF = new F();
Assert.assertSame(Pawn.Black, mF.test());
}
}
And JUnit output:
junit.framework.AssertionFailedError: expected same:<Black> was not:<Black>
Expected :Black
Actual :Black
Black is not black and is black. It's black magic. :/ What can I do to make this work (i.e. pass test)?
Aucun commentaire:
Enregistrer un commentaire