Autoplayer argument

Hello,

In the class autoplayer implementation that receives game, whenever I try to get a copy of the currentpiece, I get an error that says

java.lang.NullPointerException: Cannot invoke "tetris.game.pieces.Piece.clone()" because the return value of "tetris.game.TetrisGame.getCurrentPiece()" is null at tetris.game.TetrisGameView.getCurrentPieceCopy(TetrisGameView.java:35) at tetris.autoplay.AutoPlayerImplementation.(AutoPlayerImplementation.java:31) at tetris.game.MyTetrisFactory.createAutoPlayer(MyTetrisFactory.java:69) at prog2.tests.tetris.pub.AutoPlayerTest.playGame(AutoPlayerTest.java:57) at prog2.tests.tetris.pub.AutoPlayerTest.validMovesOnly0(AutoPlayerTest.java:24) at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)

I have checked the clone() method in tetris.game.pieces.Piece.clone(), it seems to work fine, and returns a new PieceImplementation. I’m not sure what I did wrong here.

It depends on the context you are calling the code in.
Have you written a test for this situation where you check that the object you expect to be not null is not null?
If this is the test output, is this behavior in the reference or in your implementation?