Search in sources :

Example 1 with DuplicateNameFaultMsg

use of com.vmware.vim25.DuplicateNameFaultMsg in project photon-model by vmware.

the class VimUtilsTest method convertToFault.

@Test
public void convertToFault() {
    DuplicateName fault = new DuplicateName();
    String msg = "msg";
    Exception e = new DuplicateNameFaultMsg(msg, fault);
    LocalizedMethodFault lmf = VimUtils.convertExceptionToFault(e);
    assertSame(fault, lmf.getFault());
    assertSame(msg, lmf.getLocalizedMessage());
}
Also used : LocalizedMethodFault(com.vmware.vim25.LocalizedMethodFault) DuplicateName(com.vmware.vim25.DuplicateName) DuplicateNameFaultMsg(com.vmware.vim25.DuplicateNameFaultMsg) IOException(java.io.IOException) Test(org.junit.Test)

Example 2 with DuplicateNameFaultMsg

use of com.vmware.vim25.DuplicateNameFaultMsg in project photon-model by vmware.

the class VimUtilsTest method retrhowKnownException.

@Test
public void retrhowKnownException() {
    DuplicateName dn = new DuplicateName();
    LocalizedMethodFault lmf = new LocalizedMethodFault();
    lmf.setLocalizedMessage("msg");
    lmf.setFault(dn);
    try {
        VimUtils.rethrow(lmf);
        fail();
    } catch (DuplicateNameFaultMsg msg) {
        assertSame(dn, msg.getFaultInfo());
        assertSame(lmf.getLocalizedMessage(), msg.getMessage());
    } catch (Exception e) {
        fail();
    }
}
Also used : LocalizedMethodFault(com.vmware.vim25.LocalizedMethodFault) DuplicateName(com.vmware.vim25.DuplicateName) DuplicateNameFaultMsg(com.vmware.vim25.DuplicateNameFaultMsg) IOException(java.io.IOException) Test(org.junit.Test)

Aggregations

DuplicateName (com.vmware.vim25.DuplicateName)2 DuplicateNameFaultMsg (com.vmware.vim25.DuplicateNameFaultMsg)2 LocalizedMethodFault (com.vmware.vim25.LocalizedMethodFault)2 IOException (java.io.IOException)2 Test (org.junit.Test)2