1   /* Copyright 2002-2025 CS GROUP
2    * Licensed to CS GROUP (CS) under one or more
3    * contributor license agreements.  See the NOTICE file distributed with
4    * this work for additional information regarding copyright ownership.
5    * CS licenses this file to You under the Apache License, Version 2.0
6    * (the "License"); you may not use this file except in compliance with
7    * the License.  You may obtain a copy of the License at
8    *
9    *   http://www.apache.org/licenses/LICENSE-2.0
10   *
11   * Unless required by applicable law or agreed to in writing, software
12   * distributed under the License is distributed on an "AS IS" BASIS,
13   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14   * See the License for the specific language governing permissions and
15   * limitations under the License.
16   */
17  package org.orekit.files.ccsds.ndm.cdm;
18  
19  import org.junit.jupiter.api.Assertions;
20  import org.junit.jupiter.api.Test;
21  import org.orekit.errors.OrekitException;
22  import org.orekit.errors.OrekitMessages;
23  
24  /** Tests for SigmaEigenvectorsCovariance class.
25   * These tests are used to increase condition coverage, other global tests are in CdmParser/WriterTest classes.
26   */
27  public class SigmaEigenvectorsCovarianceTest {
28  
29      /** Condition coverage on the checkScreenVolumeConditions method. */
30      @Test
31      public void testConditions() {
32  
33          SigmaEigenvectorsCovariance cov = new SigmaEigenvectorsCovariance(false);
34          
35          // !isAltCovFlagSet() in validate method
36          try {
37              cov.validate(1.0);
38              Assertions.fail("an exception should have been thrown");
39          } catch (OrekitException oe) {
40              Assertions.assertEquals(OrekitMessages.CCSDS_DATE_INVALID_PREAMBLE_FIELD, oe.getSpecifier());
41              Assertions.assertEquals(CdmMetadataKey.ALT_COV_TYPE, oe.getParts()[0]);
42          }
43          
44          // !isAltCovFlagSet() in setCsig3eigvec3 method
45          try {
46              cov.setCsig3eigvec3(null);
47              Assertions.fail("an exception should have been thrown");
48          } catch (OrekitException oe) {
49              Assertions.assertEquals(OrekitMessages.CCSDS_DATE_INVALID_PREAMBLE_FIELD, oe.getSpecifier());
50              Assertions.assertEquals(CdmMetadataKey.ALT_COV_TYPE, oe.getParts()[0]);
51          }
52          
53          // Check get/setCsig3eigvec3 when null
54          cov = new SigmaEigenvectorsCovariance(true);
55          cov.setCsig3eigvec3(null);
56          Assertions.assertEquals(null, cov.getCsig3eigvec3());
57      }
58  }