コード例 #1
0
  public void createWithoutBodyExpected(Brick... bricks) {
    BrickList _bricks = new BrickList();
    _bricks.getBricks().addAll(Arrays.asList(bricks));
    String xml = marshall(_bricks);

    HttpPost post = new PostRequestFactory().createPost(getCollectionPath(), xml);
    ResponseWrapper response = sendTransaction(post);
    AssertJUnit.assertTrue(response.getCode() == 201 || response.getCode() == 202);
  }
コード例 #2
0
  public ArrayList<Brick> create(Brick... bricks) {
    BrickList _bricks = new BrickList();
    _bricks.getBricks().addAll(Arrays.asList(bricks));
    String xml = marshall(_bricks);

    HttpPost post = new PostRequestFactory().createPost(getCollectionPath(), xml);
    ResponseWrapper response = sendTransaction(post);
    AssertJUnit.assertTrue(response.getCode() == 201 || response.getCode() == 202);

    @SuppressWarnings("unchecked")
    ArrayList<Brick> result = ((BrickList) unmarshal(response.getBody())).getBricks();
    return result;
  }