/** * This method setups the {@link ResultSet} mocked-up instance for the tests. * * @throws SQLException */ @Before public void setUp() throws SQLException { when(resultSet.getObject(COLUMN_ONE_LABEL, int.class)).thenReturn(ORDINA_FOR_ONE); when(resultSet.getObject(COLUMN_TWO_LABEL, int.class)).thenReturn(ORDINA_FOR_TWO); when(resultSet.getObject(COLUMN_THREE_LABEL, int.class)).thenReturn(ORDINA_FOR_THREE); when(resultSet.getObject(COLUMN_ONE_LABEL, String.class)).thenReturn(TestEnum.ONE.name()); when(resultSet.getObject(COLUMN_TWO_LABEL, String.class)).thenReturn(TestEnum.TWO.name()); when(resultSet.getObject(COLUMN_THREE_LABEL, String.class)).thenReturn(TestEnum.THREE.name()); when(resultSet.getDate(COLUMN_NULL_LABEL)).thenReturn(null); }
/** * Test method for {@link * ep.opensource.jpa.legacy.persistence.metadata.EnumType#to(java.lang.Enum)} for the {@link * EnumType#STRING} scenario. */ @Test public final void testToForString() { assertEquals( "The result is not the expected one", TestEnum.ONE.name(), EnumType.STRING.to(TestEnum.ONE)); assertEquals( "The result is not the expected one", TestEnum.TWO.name(), EnumType.STRING.to(TestEnum.TWO)); assertEquals( "The result is not the expected one", TestEnum.THREE.name(), EnumType.STRING.to(TestEnum.THREE)); }