I ran into this weird problem that happens when i try to run a unit test for one of my app classes: "package does not exist".
If i run the app i get the same error, but if i press "run" again it compiles and works just fine, i have also made another unit test for another class and the same process repeats i run it the first time, get the error, run it again and it compiles. But for some reason when i run this new unit test in particular i get the same error and does not compile.
Here is the particular code generating the error:
package chess_game;
import org.junit.Test;
import pieces.*;
import static org.junit.Assert.*;
public class GameTest {
@Test
public void enPassantLegalMoves(){
...
Piece bking = new King(PieceColour.BLACK);
bd[3][2].setPiece(bking);
Piece bpawn = new Pawn(PieceColour.BLACK);
bpawn.setHasMovedAlready(true);
bd[4][4].setPiece(bpawn);
Piece wking = new King(PieceColour.WHITE);
bd[7][4].setPiece(wking);
Piece wpawn = new Pawn(PieceColour.WHITE);
wpawn.setHasMovedAlready(true);
bd[4][3].setPiece(wpawn);
...
}
}
Note: I dont know if its relevant but i am using android studio and the IDE doesn`t give any warnings besided the compiling error.
Thanks in advance.
I think is the project structure.
you need to put your package pieces
in the chess_game
package. Not in chess_game (test)
この記事はインターネットから収集されたものであり、転載の際にはソースを示してください。
侵害の場合は、連絡してください[email protected]
コメントを追加