View Javadoc
1   /*
2    * CSVeed (https://github.com/42BV/CSVeed)
3    *
4    * Copyright 2013-2023 CSVeed.
5    *
6    * All rights reserved. This program and the accompanying materials
7    * are made available under the terms of The Apache Software License,
8    * Version 2.0 which accompanies this distribution, and is available at
9    * https://www.apache.org/licenses/LICENSE-2.0.txt
10   */
11  package org.csveed.bean.conversion;
12  
13  import static org.junit.jupiter.api.Assertions.assertEquals;
14  
15  import org.csveed.token.ParseState;
16  import org.junit.jupiter.api.Test;
17  
18  /**
19   * The Class EnumConverterTest.
20   */
21  class EnumConverterTest {
22  
23      /**
24       * Convert to enum.
25       *
26       * @throws Exception
27       *             the exception
28       */
29      @Test
30      void convertToEnum() throws Exception {
31          EnumConverter<ParseState> converter = new EnumConverter<>(ParseState.class);
32          assertEquals(ParseState.SKIP_LINE, converter.fromString("SKIP_LINE"));
33      }
34  
35      /**
36       * Convert from enum.
37       *
38       * @throws Exception
39       *             the exception
40       */
41      @Test
42      void convertFromEnum() throws Exception {
43          EnumConverter<ParseState> converter = new EnumConverter<>(ParseState.class);
44          assertEquals("SKIP_LINE", converter.toString(ParseState.SKIP_LINE));
45      }
46  
47  }