/*
 * Copyright 2012 Thomas Bouffard (redfish4ktc)
 *
 * 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 org.ktc.soapui.maven.extension.impl.enums;

import static org.fest.assertions.api.Assertions.assertThat;
import static org.junit.Assert.fail;

import org.junit.Test;
import org.ktc.soapui.maven.extension.impl.ProjectConversionType;

public class EnumConverterTest {

    @Test
    public void toProjectConversionType_valid_value() {
        assertThat(EnumConverter.toProjectConversionType("TO_COMPOSITE")).isEqualTo(ProjectConversionType.TO_COMPOSITE);
    }

    @Test
    public void toProjectConversionType_from_unknown_value() {
        try {
            EnumConverter.toProjectConversionType("un4658$$$");
            fail("should have thrown an Exception");
        } catch (UnknownEnumException e) {
            assertThat(e.getMessage()).isEqualTo(
                    "Unsupported project conversion type un4658$$$. Valid values are [TO_STANDARD,TO_COMPOSITE]");
        }
    }

}

@@ -1,11 +1,10 @@
 /*
-%0D
 %0A * Copy
@@ -43,21 +43,19 @@
 ish4ktc)
-%0D
 %0A *
-%0D
 %0A * Lice
@@ -113,17 +113,16 @@
 cense%22);
-%0D
 %0A * you 
@@ -181,17 +181,16 @@
 License.
-%0D
 %0A * You 
@@ -224,21 +224,19 @@
 cense at
-%0D
 %0A *
-%0D
 %0A *     
@@ -277,21 +277,19 @@
 ENSE-2.0
-%0D
 %0A *
-%0D
 %0A * Unle
@@ -351,17 +351,16 @@
 software
-%0D
 %0A * dist
@@ -420,17 +420,16 @@
 %22 BASIS,
-%0D
 %0A * WITH
@@ -496,17 +496,16 @@
 implied.
-%0D
 %0A * See 
@@ -567,17 +567,16 @@
 ions and
-%0D
 %0A * limi
@@ -605,20 +605,16 @@
 nse.
-%0D
 %0A *
-%0D
 %0A */
-%0D%0A%0D
+%0A
 %0Apac
@@ -660,19 +660,17 @@
 l.enums;
-%0D%0A%0D
+%0A
 %0Aimport 
@@ -722,17 +722,16 @@
 ertThat;
-%0D
 %0Aimport 
@@ -745,29 +745,73 @@
 org.
-junit
+fest.assertions.api
 .Assert
+ions
 .fail
-;%0D%0A%0D
+BecauseExceptionWasNotThrown;%0A
 %0Aimp
@@ -829,17 +829,16 @@
 it.Test;
-%0D
 %0Aimport 
@@ -895,19 +895,17 @@
 ionType;
-%0D%0A%0D
+%0A
 %0Apublic 
@@ -929,19 +929,17 @@
 erTest %7B
-%0D%0A%0D
+%0A
 %0A    @Te
@@ -932,33 +932,32 @@
 est %7B%0A%0A    @Test
-%0D
 %0A    public void
@@ -988,33 +988,32 @@
 _valid_value() %7B
-%0D
 %0A        assertT
@@ -1117,26 +1117,23 @@
 POSITE);
-%0D
 %0A    %7D
-%0D%0A%0D
+%0A
 %0A    @Te
@@ -1134,17 +1134,16 @@
    @Test
-%0D
 %0A    pub
@@ -1197,17 +1197,16 @@
 alue() %7B
-%0D
 %0A       
@@ -1211,17 +1211,16 @@
    try %7B
-%0D
 %0A       
@@ -1275,17 +1275,16 @@
 58$$$%22);
-%0D
 %0A       
@@ -1296,32 +1296,48 @@
 fail
-(%22should have thrown an 
+BecauseExceptionWasNotThrown(UnknownEnum
 Exce
@@ -1341,20 +1341,24 @@
 xception
-%22
+.class
 );
-%0D
 %0A       
@@ -1392,17 +1392,16 @@
 ion e) %7B
-%0D
 %0A       
@@ -1442,17 +1442,16 @@
 EqualTo(
-%0D
 %0A       
@@ -1557,17 +1557,16 @@
 SITE%5D%22);
-%0D
 %0A       
@@ -1571,18 +1571,14 @@
    %7D
-%0D
 %0A    %7D
-%0D%0A%0D
+%0A
 %0A%7D
-%0D
 %0A

Use fest-assert failBecauseExceptionWasNotThrown instead of junit fail