content: /*
   * Licensed to the Apache Software Foundation (ASF) under one
   * or more contributor license agreements.  See the NOTICE file
   * distributed with this work for additional information
   * regarding copyright ownership.  The ASF licenses this file
   * to you under the Apache License, Version 2.0 (the
   * "License"); you may not use this file except in compliance
   * with the License.  You may obtain a copy of the License at
   *
   *     http://www.apache.org/licenses/LICENSE-2.0
   *
   * 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.apache.cassandra.sidecar.common.data;
  
  import org.junit.jupiter.api.Test;
  
  import static org.apache.cassandra.sidecar.common.data.RestoreJobProgressFetchPolicy.ALL;
  import static org.apache.cassandra.sidecar.common.data.RestoreJobProgressFetchPolicy.ALL_FAILED_AND_PENDING;
  import static org.apache.cassandra.sidecar.common.data.RestoreJobProgressFetchPolicy.FIRST_FAILED;
  import static org.assertj.core.api.Assertions.assertThat;
  import static org.assertj.core.api.Assertions.assertThatThrownBy;
  
  class RestoreJobProgressFetchPolicyTest
  {
      @Test
      void testFromString()
      {
          assertThat(RestoreJobProgressFetchPolicy.fromString("FIRST_failed"))
          .isEqualTo(FIRST_FAILED);
          assertThat(RestoreJobProgressFetchPolicy.fromString("first_failed"))
          .isEqualTo(FIRST_FAILED);
          assertThat(RestoreJobProgressFetchPolicy.fromString("FIRST_FAILED"))
          .isEqualTo(FIRST_FAILED);
  
          assertThat(RestoreJobProgressFetchPolicy.fromString("all_failed_and_pending"))
          .isEqualTo(ALL_FAILED_AND_PENDING);
          assertThat(RestoreJobProgressFetchPolicy.fromString("ALL_FAILED_and_pending"))
          .isEqualTo(ALL_FAILED_AND_PENDING);
          assertThat(RestoreJobProgressFetchPolicy.fromString("ALL_FAILED_AND_PENDING"))
          .isEqualTo(ALL_FAILED_AND_PENDING);
  
          assertThat(RestoreJobProgressFetchPolicy.fromString("all"))
          .isEqualTo(ALL);
          assertThat(RestoreJobProgressFetchPolicy.fromString("ALL"))
          .isEqualTo(ALL);
      }
  
      @Test
      void testFromStringFails()
      {
          assertThatThrownBy(() -> RestoreJobProgressFetchPolicy.fromString("unknown"))
          .isExactlyInstanceOf(IllegalArgumentException.class)
          .hasMessage("No RestoreJobProgressFetchPolicy found for unknown");
      }
  }
  