/*
 * The Alluxio Open Foundation licenses this work under the Apache License, version 2.0
 * (the "License"). You may not use this work except in compliance with the License, which is
 * available at www.apache.org/licenses/LICENSE-2.0
 *
 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
 * either express or implied, as more fully set forth in the License.
 *
 * See the NOTICE file distributed with this work for information regarding copyright ownership.
 */

package alluxio.exception;

import alluxio.thrift.AlluxioTException;

import org.junit.Assert;
import org.junit.Test;

public class AlluxioExceptionTest {

  @Test
  public void unexpectedException() {
    AlluxioTException tException = new AlluxioTException("testType", "testMessage", "testClass");
    AlluxioException exception = AlluxioException.fromThrift(tException);
    Assert.assertTrue(exception instanceof UnexpectedAlluxioException);
  }
}

@@ -687,24 +687,21 @@
  void un
-expected
+known
 Exceptio
@@ -706,16 +706,76 @@
 ion() %7B%0A
+    try %7B%0A      final String testMessage = %22testMessage%22;%0A  
     Allu
@@ -831,25 +831,24 @@
 %22testType%22, 
-%22
 testMessage%22
@@ -846,17 +846,16 @@
 tMessage
-%22
 , %22testC
@@ -862,16 +862,18 @@
 lass%22);%0A
+  
     Allu
@@ -942,16 +942,18 @@
 n);%0A    
+  
 Assert.a
@@ -961,62 +961,180 @@
 sert
-True(exception instanceof UnexpectedAlluxioException);
+Equals(testMessage, exception.getMessage());%0A    %7D catch (Exception e) %7B%0A      // this should never happen%0A      Assert.fail(%22unexpected exception%22 + e.getMessage());%0A    %7D
 %0A  %7D

Address review comments.