code:     private void assertRecoveryStateWithoutStage(RecoveryState state, int shardId, Type type,
                                                   String sourceNode, String targetNode, boolean hasRestoreSource) {
          assertThat(state.getShardId().getId(), equalTo(shardId));
          assertThat(state.getType(), equalTo(type));
          if (sourceNode == null) {
              assertNull(state.getSourceNode());
          } else {
              assertNotNull(state.getSourceNode());
              assertThat(state.getSourceNode().getName(), equalTo(sourceNode));
          }
          if (targetNode == null) {
              assertNull(state.getTargetNode());
          } else {
              assertNotNull(state.getTargetNode());
              assertThat(state.getTargetNode().getName(), equalTo(targetNode));
          }
          if (hasRestoreSource) {
              assertNotNull(state.getRestoreSource());
          } else {
              assertNull(state.getRestoreSource());
          }
  
      }
  
  