title: restassured - I can't pass one variable from one method to another
body: <p>I'm fairly new to rest assured and Java, and I'm trying to get a variable from one method (or test case) to another, and I keep getting "null".</p>
  
  <p>I've tried many different things but I just keep getting the error. Basically, what I want is to get "id" from test "getTweet" and pass it to test "deleteTweet". Any help would be very much appreciated.</p>
  
  <pre><code>import io.restassured.RestAssured;
  import io.restassured.path.json.JsonPath;
  import io.restassured.response.Response;
  import static io.restassured.RestAssured.given;
  
  import org.testng.annotations.Test;
  
  
  
  public class twitterTesting {
  
  
      String consumerKey = consumer;
      String consumerSecret = secretConsumer;
      String accessToken = token;
      String accessSecret = secretToken;
      String tweetText = "Never give up!";
      String id;
  
  
  
      @Test
      public void createTweet() {
          RestAssured.baseURI = "https://api.twitter.com/1.1/statuses";
          given().
                  auth().oauth(consumer, secretConsumer, token, secretToken).
                  queryParam("status", tweetText).
                  when().post("/update.json").
                  then().assertThat().statusCode(200);
  
  
  
      }
  
     @Test
      public void getTweet() {
          RestAssured.baseURI = "https://api.twitter.com/1.1/statuses";
          Response res2 = given().
                          auth().oauth(consumerKey, consumerSecret, accessToken, accessSecret).
                          queryParam("count", "1").
                          when().get("/home_timeline.json").
                          then().assertThat().statusCode(200).
                          and().extract().response();
          JsonPath jsonResponse = resources.rawToJson(res2);
          String text = jsonResponse.getString("text");
          id = jsonResponse.getString("id");
          System.out.println(id);
          //System.out.println("/destroy/" + (id.substring(1, id.length()-1) + ".json"));
          String textModified = text.substring(1, text.length()-1);
          System.out.println(textModified);
          System.out.println(tweetText);
  
          assert text.contains(tweetText); //true
      }
  
      @Test
      public void deleteTweet() {
          System.out.println("/destroy/" + id + ".json");
  
      }
  }
  </code></pre>
  
  <p>I keep getting /destroy/null.json when it comes to sending id variable to the "deleteTweet" test case.</p>