Let us change the return type of our saveMove method to boolean:
@Test public void whenSaveMoveThenReturnTrue() { TicTacToeBean bean = new TicTacToeBean(3, 2, 1, 'Y'); MongoCollection mongoCollection = mock(MongoCollection.class); doReturn(mongoCollection).when(collection).getMongoCollection(); assertTrue(collection.saveMove(bean)); }