content: /**
   * Copyright (C) 2024 AIDC-AI
   *
   * Licensed 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 com.alibaba.langengine.confluence.exception;
  
  import org.junit.Test;
  import static org.junit.Assert.*;
  
  /**
   * Confluence异常测试类
   * 
   * @author AIDC-AI
   */
  public class ConfluenceExceptionTest {
      
      @Test
      public void testConstructorWithMessage() {
          String message = "Test exception message";
          ConfluenceException exception = new ConfluenceException(message);
          
          assertEquals(message, exception.getMessage());
          assertEquals(0, exception.getStatusCode());
      }
      
      @Test
      public void testConstructorWithMessageAndCause() {
          String message = "Test exception message";
          Throwable cause = new RuntimeException("Root cause");
          ConfluenceException exception = new ConfluenceException(message, cause);
          
          assertEquals(message, exception.getMessage());
          assertEquals(cause, exception.getCause());
          assertEquals(0, exception.getStatusCode());
      }
      
      @Test
      public void testConstructorWithStatusCodeAndMessage() {
          int statusCode = 404;
          String message = "Not found";
          ConfluenceException exception = new ConfluenceException(statusCode, message);
          
          assertEquals(message, exception.getMessage());
          assertEquals(statusCode, exception.getStatusCode());
      }
      
      @Test
      public void testConstructorWithStatusCodeMessageAndCause() {
          int statusCode = 500;
          String message = "Internal server error";
          Throwable cause = new RuntimeException("Root cause");
          ConfluenceException exception = new ConfluenceException(statusCode, message, cause);
          
          assertEquals(message, exception.getMessage());
          assertEquals(cause, exception.getCause());
          assertEquals(statusCode, exception.getStatusCode());
      }
      
      @Test
      public void testGetStatusCode() {
          ConfluenceException exception1 = new ConfluenceException("Message");
          assertEquals(0, exception1.getStatusCode());
          
          ConfluenceException exception2 = new ConfluenceException(400, "Bad request");
          assertEquals(400, exception2.getStatusCode());
      }
      
      @Test
      public void testInheritance() {
          ConfluenceException exception = new ConfluenceException("Test message");
          assertTrue(exception instanceof Exception);
      }
  }
  