<commit_before>/**
 * This document is a part of the source code and related artifacts
 * for CollectionSpace, an open source collections management system
 * for museums and related institutions:
 *
 * http://www.collectionspace.org
 * http://wiki.collectionspace.org
 *
 * Copyright © 2009 Regents of the University of California
 *
 * Licensed under the Educational Community License (ECL), Version 2.0.
 * You may not use this file except in compliance with this License.
 *
 * You may obtain a copy of the ECL 2.0 License at
 * https://source.collectionspace.org/collection-space/LICENSE.txt
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
 
package org.collectionspace.services.client.test;

import java.util.ArrayList;
import java.util.List;
import javax.ws.rs.core.MultivaluedMap;
import javax.ws.rs.core.Response;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.Marshaller;
import org.jboss.resteasy.client.ClientResponse;
import org.testng.Assert;
import org.testng.annotations.Test;

import org.collectionspace.services.intake.Intake;
import org.collectionspace.services.intake.IntakeList;
import org.collectionspace.services.client.IntakeClient;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * IntakeServiceTest, carries out tests against a
 * deployed and running Intake Service.
 * 
 * $LastChangedRevision: 511 $
 * $LastChangedDate: 2009-08-06 20:16:16 +0000 (Thu, 06 Aug 2009) $
 */
public class IntakeServiceTest {

  private IntakeClient intakeClient = new IntakeClient();
  private String knownIntakeId = null;
  private final String NON_EXISTENT_ID = createNonExistentIdentifier();
  final Logger logger = LoggerFactory.getLogger(IntakeServiceTest.class);

  // ---------------------------------------------------------------
  // Service Discovery tests
  // ---------------------------------------------------------------

  // TBA
  
  
  // ---------------------------------------------------------------
  // CRUD tests : CREATE tests
  // ---------------------------------------------------------------

  // Success outcomes
  // ----------------
  
  /**
   * Tests creation of a new Intake.
   *
   * Expected status code: 201 Created
   *
   * Also expected: The 'Location' header contains the URL for the newly created object.
   * This is required by the extractId() utility method, below.
   *
   * The newly-created Intake is also used by other test(s)
   * (e.g. update, delete) which follow, below.
   */
  @Test
  public void createIntake() {
    String identifier = this.createIdentifier();

    Intake intake = createIntake(identifier);
    ClientResponse<Response> res = intakeClient.createIntake(intake);
    verbose("createIntake: status = " + res.getStatus());
    Assert.assertEquals(res.getStatus(), Response.Status.CREATED.getStatusCode());

    // Store the ID returned from this create operation for additional tests below.
    knownIntakeId = extractId(res);
  }

  /**
   * Creates two or more new Intakes.
   *
   * Repeatedly calls the createIntake test, above, and relies on its
   * test assertions.
   *
   * Expected status code: 201 Created
   *
   * The newly-created Intakes are also used by other test(s)
   * (e.g. read multiple/list) which follow, below.
   */
  @Test(dependsOnMethods = {"createIntake"})
  public void createCollection() {
    for(int i = 0; i < 3; i++){
      this.createIntake();
    }
  }

  // Failure outcomes
  // ----------------

  /**
   * Tests creation of a Intake by sending a null to the client proxy.
   *
   * Expected status code: (none)
   *
   * Expected result: IllegalArgumentException 
   * (Make sure this is a reported exception in the called class.)
   */
  @Test(dependsOnMethods = {"createIntake"}, expectedExceptions = IllegalArgumentException.class)
  public void createNullIntake() {
    ClientResponse<Response> res = intakeClient.createIntake(null);
  }
		
  /**
   * Tests creation of an Intake by sending bad data
   * (e.g. in a format that doesn't match the Intake schema)
   * in the entity body of the request.
   *
   * Expected status code: 400 Bad Request
   */
/*
  @Test(dependsOnMethods = {"createIntake"})
  public void createIntakeWithBadData() {
    // Currently only a stub.
  }
*/

  /**
   * Tests creation of an Intake by a user who
   * is not authorized to perform this action.
   *
   * Expected status code: 403 Forbidden
   */
/*
  @Test(dependsOnMethods = {"createIntake"})
  public void createIntakeWithUnauthorizedUser() {
    // Currently only a stub.
  }
*/

  /**
   * Tests creation of a duplicate Intake, whose unique resource identifier
   * duplicates that of an existing Intake.
   * 
   * Expected status code: 409 Conflict
   */
/*
  @Test(dependsOnMethods = {"createIntake"})
  public void createDuplicateIntake() {
    Intake intake = createIntake(knownIntakeId);
    ClientResponse<Response> res = 
      intakeClient.createIntake(intake);
    verbose("createDuplicateIntake: status = " + res.getStatus());
    Assert.assertEquals(res.getStatus(), Response.Status.CONFLICT.getStatusCode());
  }
*/

  // ---------------------------------------------------------------
  // CRUD tests : READ tests
  // ---------------------------------------------------------------

  // Success outcomes
  // ----------------
  
  /**
   * Tests reading (i.e. retrieval) of a Intake.
   *
   * Expected status code: 200 OK
   */
  @Test(dependsOnMethods = {"createIntake"})
  public void getIntake() {
    ClientResponse<Intake> res = 
      intakeClient.getIntake(knownIntakeId);
    verbose("getIntake: status = " + res.getStatus());
    Assert.assertEquals(res.getStatus(), Response.Status.OK.getStatusCode());
  }

  // Failure outcomes
  // ----------------

  /**
   * Tests reading (i.e. retrieval) of a Intake by a user who
   * is not authorized to perform this action.
   *
   * Expected status code: 403 Forbidden
   */
/*
  @Test(dependsOnMethods = {"getIntake"})
  public void getIntakeWithUnauthorizedUser() {
    // Currently only a stub
  }
*/

  /**
   * Tests reading (i.e. retrieval) of a non-existent Intake,
   * whose resource identifier does not exist at the specified URL.
   *
   * Expected status code: 404 Not Found
   */
  @Test(dependsOnMethods = {"getIntake"})
  public void getNonExistentIntake() {
    ClientResponse<Intake> res = 
      intakeClient.getIntake(NON_EXISTENT_ID);
    verbose("getNonExistentIntake: status = " + res.getStatus());
    Assert.assertEquals(res.getStatus(), Response.Status.NOT_FOUND.getStatusCode());
  }


  // ---------------------------------------------------------------
  // CRUD tests : READ (list, or multiple) tests
  // ---------------------------------------------------------------

  // Success outcomes
  // ----------------

  /**
   * Tests reading (i.e. retrieval) of a list of multiple Intakes.
   *
   * Expected status code: 200 OK
   *
   * Also expected: The entity body in the response contains
   * a representation of the list of Intakes.
   */
  @Test(dependsOnMethods = {"createCollection"})
  public void getIntakeList() {
    // The resource method is expected to return at least an empty list
    ClientResponse<IntakeList> res = intakeClient.getIntakeList();
    IntakeList coList = res.getEntity();
    verbose("getIntakeList: status = " + res.getStatus());
    Assert.assertEquals(res.getStatus(), Response.Status.OK.getStatusCode());

    List<IntakeList.IntakeListItem> coItemList =
      coList.getIntakeListItem();
    int i = 0;
    for(IntakeList.IntakeListItem pli : coItemList){
      verbose("getIntakeList: list-item[" + i + "] csid=" + pli.getCsid());
      verbose("getIntakeList: list-item[" + i + "] entryNumber=" + pli.getEntryNumber());
      verbose("getIntakeList: list-item[" + i + "] URI=" + pli.getUri());
      i++;
    }
  }

  /**
   * Tests reading (i.e. retrieval) of a list of multiple Intakes
   * when the contents of the list are expected to be empty.
   *
   * Expected status code: 200 OK
   * (Note: *not* 204 No Content)
   *
   * Also expected: The entity body in the response contains
   * a representation of an empty list of Intakes.
   */
/*
  @Test(dependsOnMethods = {"getIntakeList"})
  public void getIntakeEmptyList() {
    // Currently only a stub.
  }
*/
  
  // Failure outcomes
  // ----------------

  /**
   * Tests reading (i.e. retrieval) of a list of Intakes
   * when sending unrecognized query parameters with the request.
   *
   * Expected status code: 400 Bad Request
   */
/*
  @Test(dependsOnMethods = {"getIntakeList"})
  public void getIntakeListWithBadParams() {
    // Currently only a stub.
  }
*/

  /**
   * Tests reading (i.e. retrieval) of a list of Intakes by a user who
   * is not authorized to perform this action.
   *
   * Expected status code: 403 Forbidden
   */
/*
  @Test(dependsOnMethods = {"getIntakeList"})
  public void getIntakeListWithUnauthorizedUser() {
    // Currently only a stub.
  }
*/

  

  // ---------------------------------------------------------------
  // CRUD tests : UPDATE tests
  // ---------------------------------------------------------------

  // Success outcomes
  // ----------------

  /**
   * Tests updating the content of a Intake.
   *
   * Expected status code: 200 OK
   *
   * Also expected: The entity body in the response contains
   * a representation of the updated Intake.
   */
  @Test(dependsOnMethods = {"createIntake"})
  public void updateIntake() {
    ClientResponse<Intake> res = 
      intakeClient.getIntake(knownIntakeId);
    verbose("getIntake: status = " + res.getStatus());
    Assert.assertEquals(res.getStatus(), Response.Status.OK.getStatusCode());
    Intake intake = res.getEntity();
    verbose("Got Intake to update with ID: " + knownIntakeId,
        intake, Intake.class);

    //intake.setCsid("updated-" + knownIntakeId);
    intake.setEntryNumber("updated-" + intake.getEntryNumber());
    intake.setEntryDate("updated-" + intake.getEntryDate());
    
    // make call to update service
    res = 
      intakeClient.updateIntake(knownIntakeId, intake);
    verbose("updateIntake: status = " + res.getStatus());
    Assert.assertEquals(res.getStatus(), Response.Status.OK.getStatusCode());
    
    // check the response
    Intake updatedIntake = res.getEntity();
    Assert.assertEquals(updatedIntake.getEntryDate(), intake.getEntryDate());
    verbose("updateIntake ", updatedIntake, Intake.class);
  }

  // Failure outcomes
  // ----------------

  /**
   * Tests updating the content of a Intake by sending bad data
   * (e.g. in a format that doesn't match the Intake schema)
   * in the entity body of the request.
   *
   * Expected status code: 400 Bad Request
   */
/*
  @Test(dependsOnMethods = {"updateIntake"})
  public void updateIntakeWithBadData() {
    // Currently only a stub.
  }
*/

  /**
   * Tests updating the content of a Intake by a user who
   * is not authorized to perform this action.
   *
   * Expected status code: 403 Forbidden
   */
/*
  @Test(dependsOnMethods = {"updateIntake"})
  public void updateIntakeWithUnauthorizedUser() {
    // Currently only a stub.
  }
*/

  /**
   * Tests updating the content of a non-existent Intake, whose
   * resource identifier does not exist.
   *
   * Expected status code: 404 Not Found
   */
  @Test(dependsOnMethods = {"updateIntake"})
  public void updateNonExistentIntake() {
    // Note: The ID used in this 'create' call may be arbitrary.
    // The only relevant ID may be the one used in updateIntake(), below.
    Intake intake = createIntake(NON_EXISTENT_ID);
    // make call to update service
    ClientResponse<Intake> res =
      intakeClient.updateIntake(NON_EXISTENT_ID, intake);
    verbose("createIntake: status = " + res.getStatus());
    Assert.assertEquals(res.getStatus(), Response.Status.NOT_FOUND.getStatusCode());
  }


  // ---------------------------------------------------------------
  // CRUD tests : DELETE tests
  // ---------------------------------------------------------------

  // Success outcomes
  // ----------------

  /**
   * Tests deleting a Intake.
   *
   * Expected status code: 200 OK
   */
  @Test(dependsOnMethods = {"createIntake", "getIntake"})
  public void deleteIntake() {
    verbose("Calling deleteIntake: " + knownIntakeId);
    ClientResponse<Response> res = intakeClient.deleteIntake(knownIntakeId);
    verbose("deleteIntake csid=" + knownIntakeId);
    verbose("deleteIntake: status = " + res.getStatus());
    Assert.assertEquals(res.getStatus(), Response.Status.OK.getStatusCode());
  }

  // Failure outcomes
  // ----------------

  /**
   * Tests deleting a Intake by a user who
   * is not authorized to perform this action.
   *
   * Expected status code: 403 Forbidden
   */<commit_msg>CSPACE-330,CSPACE-327: Added 'updateIntake' test dependency to the 'deleteIntake' test, akin to corresponding change made for CollectionObject tests in r566.<commit_after>/**
 * This document is a part of the source code and related artifacts
 * for CollectionSpace, an open source collections management system
 * for museums and related institutions:
 *
 * http://www.collectionspace.org
 * http://wiki.collectionspace.org
 *
 * Copyright © 2009 Regents of the University of California
 *
 * Licensed under the Educational Community License (ECL), Version 2.0.
 * You may not use this file except in compliance with this License.
 *
 * You may obtain a copy of the ECL 2.0 License at
 * https://source.collectionspace.org/collection-space/LICENSE.txt
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
 
package org.collectionspace.services.client.test;

import java.util.ArrayList;
import java.util.List;
import javax.ws.rs.core.MultivaluedMap;
import javax.ws.rs.core.Response;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.Marshaller;
import org.jboss.resteasy.client.ClientResponse;
import org.testng.Assert;
import org.testng.annotations.Test;

import org.collectionspace.services.intake.Intake;
import org.collectionspace.services.intake.IntakeList;
import org.collectionspace.services.client.IntakeClient;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * IntakeServiceTest, carries out tests against a
 * deployed and running Intake Service.
 * 
 * $LastChangedRevision: 511 $
 * $LastChangedDate: 2009-08-06 20:16:16 +0000 (Thu, 06 Aug 2009) $
 */
public class IntakeServiceTest {

  private IntakeClient intakeClient = new IntakeClient();
  private String knownIntakeId = null;
  private final String NON_EXISTENT_ID = createNonExistentIdentifier();
  final Logger logger = LoggerFactory.getLogger(IntakeServiceTest.class);

  // ---------------------------------------------------------------
  // Service Discovery tests
  // ---------------------------------------------------------------

  // TBA
  
  
  // ---------------------------------------------------------------
  // CRUD tests : CREATE tests
  // ---------------------------------------------------------------

  // Success outcomes
  // ----------------
  
  /**
   * Tests creation of a new Intake.
   *
   * Expected status code: 201 Created
   *
   * Also expected: The 'Location' header contains the URL for the newly created object.
   * This is required by the extractId() utility method, below.
   *
   * The newly-created Intake is also used by other test(s)
   * (e.g. update, delete) which follow, below.
   */
  @Test
  public void createIntake() {
    String identifier = this.createIdentifier();

    Intake intake = createIntake(identifier);
    ClientResponse<Response> res = intakeClient.createIntake(intake);
    verbose("createIntake: status = " + res.getStatus());
    Assert.assertEquals(res.getStatus(), Response.Status.CREATED.getStatusCode());

    // Store the ID returned from this create operation for additional tests below.
    knownIntakeId = extractId(res);
  }

  /**
   * Creates two or more new Intakes.
   *
   * Repeatedly calls the createIntake test, above, and relies on its
   * test assertions.
   *
   * Expected status code: 201 Created
   *
   * The newly-created Intakes are also used by other test(s)
   * (e.g. read multiple/list) which follow, below.
   */
  @Test(dependsOnMethods = {"createIntake"})
  public void createCollection() {
    for(int i = 0; i < 3; i++){
      this.createIntake();
    }
  }

  // Failure outcomes
  // ----------------

  /**
   * Tests creation of a Intake by sending a null to the client proxy.
   *
   * Expected status code: (none)
   *
   * Expected result: IllegalArgumentException 
   * (Make sure this is a reported exception in the called class.)
   */
  @Test(dependsOnMethods = {"createIntake"}, expectedExceptions = IllegalArgumentException.class)
  public void createNullIntake() {
    ClientResponse<Response> res = intakeClient.createIntake(null);
  }
		
  /**
   * Tests creation of an Intake by sending bad data
   * (e.g. in a format that doesn't match the Intake schema)
   * in the entity body of the request.
   *
   * Expected status code: 400 Bad Request
   */
/*
  @Test(dependsOnMethods = {"createIntake"})
  public void createIntakeWithBadData() {
    // Currently only a stub.
  }
*/

  /**
   * Tests creation of an Intake by a user who
   * is not authorized to perform this action.
   *
   * Expected status code: 403 Forbidden
   */
/*
  @Test(dependsOnMethods = {"createIntake"})
  public void createIntakeWithUnauthorizedUser() {
    // Currently only a stub.
  }
*/

  /**
   * Tests creation of a duplicate Intake, whose unique resource identifier
   * duplicates that of an existing Intake.
   * 
   * Expected status code: 409 Conflict
   */
/*
  @Test(dependsOnMethods = {"createIntake"})
  public void createDuplicateIntake() {
    Intake intake = createIntake(knownIntakeId);
    ClientResponse<Response> res = 
      intakeClient.createIntake(intake);
    verbose("createDuplicateIntake: status = " + res.getStatus());
    Assert.assertEquals(res.getStatus(), Response.Status.CONFLICT.getStatusCode());
  }
*/

  // ---------------------------------------------------------------
  // CRUD tests : READ tests
  // ---------------------------------------------------------------

  // Success outcomes
  // ----------------
  
  /**
   * Tests reading (i.e. retrieval) of a Intake.
   *
   * Expected status code: 200 OK
   */
  @Test(dependsOnMethods = {"createIntake"})
  public void getIntake() {
    ClientResponse<Intake> res = 
      intakeClient.getIntake(knownIntakeId);
    verbose("getIntake: status = " + res.getStatus());
    Assert.assertEquals(res.getStatus(), Response.Status.OK.getStatusCode());
  }

  // Failure outcomes
  // ----------------

  /**
   * Tests reading (i.e. retrieval) of a Intake by a user who
   * is not authorized to perform this action.
   *
   * Expected status code: 403 Forbidden
   */
/*
  @Test(dependsOnMethods = {"getIntake"})
  public void getIntakeWithUnauthorizedUser() {
    // Currently only a stub
  }
*/

  /**
   * Tests reading (i.e. retrieval) of a non-existent Intake,
   * whose resource identifier does not exist at the specified URL.
   *
   * Expected status code: 404 Not Found
   */
  @Test(dependsOnMethods = {"getIntake"})
  public void getNonExistentIntake() {
    ClientResponse<Intake> res = 
      intakeClient.getIntake(NON_EXISTENT_ID);
    verbose("getNonExistentIntake: status = " + res.getStatus());
    Assert.assertEquals(res.getStatus(), Response.Status.NOT_FOUND.getStatusCode());
  }


  // ---------------------------------------------------------------
  // CRUD tests : READ (list, or multiple) tests
  // ---------------------------------------------------------------

  // Success outcomes
  // ----------------

  /**
   * Tests reading (i.e. retrieval) of a list of multiple Intakes.
   *
   * Expected status code: 200 OK
   *
   * Also expected: The entity body in the response contains
   * a representation of the list of Intakes.
   */
  @Test(dependsOnMethods = {"createCollection"})
  public void getIntakeList() {
    // The resource method is expected to return at least an empty list
    ClientResponse<IntakeList> res = intakeClient.getIntakeList();
    IntakeList coList = res.getEntity();
    verbose("getIntakeList: status = " + res.getStatus());
    Assert.assertEquals(res.getStatus(), Response.Status.OK.getStatusCode());

    List<IntakeList.IntakeListItem> coItemList =
      coList.getIntakeListItem();
    int i = 0;
    for(IntakeList.IntakeListItem pli : coItemList){
      verbose("getIntakeList: list-item[" + i + "] csid=" + pli.getCsid());
      verbose("getIntakeList: list-item[" + i + "] entryNumber=" + pli.getEntryNumber());
      verbose("getIntakeList: list-item[" + i + "] URI=" + pli.getUri());
      i++;
    }
  }

  /**
   * Tests reading (i.e. retrieval) of a list of multiple Intakes
   * when the contents of the list are expected to be empty.
   *
   * Expected status code: 200 OK
   * (Note: *not* 204 No Content)
   *
   * Also expected: The entity body in the response contains
   * a representation of an empty list of Intakes.
   */
/*
  @Test(dependsOnMethods = {"getIntakeList"})
  public void getIntakeEmptyList() {
    // Currently only a stub.
  }
*/
  
  // Failure outcomes
  // ----------------

  /**
   * Tests reading (i.e. retrieval) of a list of Intakes
   * when sending unrecognized query parameters with the request.
   *
   * Expected status code: 400 Bad Request
   */
/*
  @Test(dependsOnMethods = {"getIntakeList"})
  public void getIntakeListWithBadParams() {
    // Currently only a stub.
  }
*/

  /**
   * Tests reading (i.e. retrieval) of a list of Intakes by a user who
   * is not authorized to perform this action.
   *
   * Expected status code: 403 Forbidden
   */
/*
  @Test(dependsOnMethods = {"getIntakeList"})
  public void getIntakeListWithUnauthorizedUser() {
    // Currently only a stub.
  }
*/

  

  // ---------------------------------------------------------------
  // CRUD tests : UPDATE tests
  // ---------------------------------------------------------------

  // Success outcomes
  // ----------------

  /**
   * Tests updating the content of a Intake.
   *
   * Expected status code: 200 OK
   *
   * Also expected: The entity body in the response contains
   * a representation of the updated Intake.
   */
  @Test(dependsOnMethods = {"createIntake"})
  public void updateIntake() {
    ClientResponse<Intake> res = 
      intakeClient.getIntake(knownIntakeId);
    verbose("getIntake: status = " + res.getStatus());
    Assert.assertEquals(res.getStatus(), Response.Status.OK.getStatusCode());
    Intake intake = res.getEntity();
    verbose("Got Intake to update with ID: " + knownIntakeId,
        intake, Intake.class);

    //intake.setCsid("updated-" + knownIntakeId);
    intake.setEntryNumber("updated-" + intake.getEntryNumber());
    intake.setEntryDate("updated-" + intake.getEntryDate());
    
    // make call to update service
    res = 
      intakeClient.updateIntake(knownIntakeId, intake);
    verbose("updateIntake: status = " + res.getStatus());
    Assert.assertEquals(res.getStatus(), Response.Status.OK.getStatusCode());
    
    // check the response
    Intake updatedIntake = res.getEntity();
    Assert.assertEquals(updatedIntake.getEntryDate(), intake.getEntryDate());
    verbose("updateIntake ", updatedIntake, Intake.class);
  }

  // Failure outcomes
  // ----------------

  /**
   * Tests updating the content of a Intake by sending bad data
   * (e.g. in a format that doesn't match the Intake schema)
   * in the entity body of the request.
   *
   * Expected status code: 400 Bad Request
   */
/*
  @Test(dependsOnMethods = {"updateIntake"})
  public void updateIntakeWithBadData() {
    // Currently only a stub.
  }
*/

  /**
   * Tests updating the content of a Intake by a user who
   * is not authorized to perform this action.
   *
   * Expected status code: 403 Forbidden
   */
/*
  @Test(dependsOnMethods = {"updateIntake"})
  public void updateIntakeWithUnauthorizedUser() {
    // Currently only a stub.
  }
*/

  /**
   * Tests updating the content of a non-existent Intake, whose
   * resource identifier does not exist.
   *
   * Expected status code: 404 Not Found
   */
  @Test(dependsOnMethods = {"updateIntake"})
  public void updateNonExistentIntake() {
    // Note: The ID used in this 'create' call may be arbitrary.
    // The only relevant ID may be the one used in updateIntake(), below.
    Intake intake = createIntake(NON_EXISTENT_ID);
    // make call to update service
    ClientResponse<Intake> res =
      intakeClient.updateIntake(NON_EXISTENT_ID, intake);
    verbose("createIntake: status = " + res.getStatus());
    Assert.assertEquals(res.getStatus(), Response.Status.NOT_FOUND.getStatusCode());
  }


  // ---------------------------------------------------------------
  // CRUD tests : DELETE tests
  // ---------------------------------------------------------------

  // Success outcomes
  // ----------------

  /**
   * Tests deleting a Intake.
   *
   * Expected status code: 200 OK
   */
  @Test(dependsOnMethods = {"createIntake", "getIntake", "updateIntake"})
  public void deleteIntake() {
    verbose("Calling deleteIntake: " + knownIntakeId);
    ClientResponse<Response> res = intakeClient.deleteIntake(knownIntakeId);
    verbose("deleteIntake csid=" + knownIntakeId);
    verbose("deleteIntake: status = " + res.getStatus());
    Assert.assertEquals(res.getStatus(), Response.Status.OK.getStatusCode());
  }

  // Failure outcomes
  // ----------------

  /**
   * Tests deleting a Intake by a user who
   * is not authorized to perform this action.
   *
   * Expected status code: 403 Forbidden
   */
{'fraction_non_alphanumeric': 0.17389147523467907, 'fraction_numerical': 0.007746317637182325, 'mean_word_length': 2.4154828619835786, 'pattern_counts': {'":': 0, '<': 25, '<?xml version=': 0, '>': 23, 'https://': 2, 'lorem ipsum': 0, 'www.': 2, 'xml': 4}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1571472', 'n_tokens_mistral': 7658, 'n_tokens_neox': 7284, 'n_words': 2193}