test_class.declarator: COLUMN_DEFAULT_VALUE = "0"
test_class.modifier: private static final
test_class.original_string: private static final String COLUMN_DEFAULT_VALUE = "0";
test_class.type: String
test_class.var_name: COLUMN_DEFAULT_VALUE
test_class.declarator: COLUMN_SIZE = "16"
test_class.modifier: private static final
test_class.original_string: private static final String COLUMN_SIZE = "16";
test_class.type: String
test_class.var_name: COLUMN_SIZE
test_class.declarator: DECIMAL_DIGITS = "2"
test_class.modifier: private static final
test_class.original_string: private static final String DECIMAL_DIGITS = "2";
test_class.type: String
test_class.var_name: DECIMAL_DIGITS
test_class.declarator: NOT_NULLABLE = 0
test_class.modifier: private static final
test_class.original_string: private static final int NOT_NULLABLE = 0;
test_class.type: int
test_class.var_name: NOT_NULLABLE
test_class.declarator: NUMERIC_TYPE_NAME = "NUMERIC"
test_class.modifier: private static final
test_class.original_string: private static final String NUMERIC_TYPE_NAME = "NUMERIC";
test_class.type: String
test_class.var_name: NUMERIC_TYPE_NAME
test_class.declarator: REQUIRED = true
test_class.modifier: private static final
test_class.original_string: private static final boolean REQUIRED = true;
test_class.type: boolean
test_class.var_name: REQUIRED
test_class.declarator: SCHEMA_COLUMNS_SIZE = COLUMN_SIZE + "," + DECIMAL_DIGITS
test_class.modifier: private static final
test_class.original_string: private static final String SCHEMA_COLUMNS_SIZE = COLUMN_SIZE + "," + DECIMAL_DIGITS;
test_class.type: String
test_class.var_name: SCHEMA_COLUMNS_SIZE
test_class.declarator: VARCHAR_TYPE_NAME = "VARCHAR"
test_class.modifier: private static final
test_class.original_string: private static final String VARCHAR_TYPE_NAME = "VARCHAR";
test_class.type: String
test_class.var_name: VARCHAR_TYPE_NAME
test_class.file: herd-code/herd-service/src/test/java/org/finra/herd/service/helper/RelationalTableRegistrationHelperTest.java
test_class.identifier: RelationalTableRegistrationHelperTest
test_class.superclass: extends AbstractServiceTest
test_case.body: @Test
      public void testGetSchemaColumns() throws SQLException
      {
          // Create a mock result set.
          ResultSet resultSetMock = mock(ResultSet.class);
  
          // Setup the mock results.
          when(resultSetMock.next()).thenReturn(true).thenReturn(false);
          when(resultSetMock.getString("COLUMN_NAME")).thenReturn(COLUMN_NAME);
          when(resultSetMock.getString("TYPE_NAME")).thenReturn(NUMERIC_TYPE_NAME);
          when(resultSetMock.getString("COLUMN_SIZE")).thenReturn(COLUMN_SIZE);
          when(resultSetMock.getString("DECIMAL_DIGITS")).thenReturn(DECIMAL_DIGITS);
          when(resultSetMock.getInt("NULLABLE")).thenReturn(NOT_NULLABLE);
          when(resultSetMock.getString("COLUMN_DEF")).thenReturn(COLUMN_DEFAULT_VALUE);
  
          // Call the method under test.
          List<SchemaColumn> schemaColumns = relationalTableRegistrationHelper.getSchemaColumns(resultSetMock);
  
          // Verify the test results.
          assertThat("The list size is not correct.", schemaColumns.size(), is(equalTo(1)));
          assertThat("The column name is not correct.", schemaColumns.get(0).getName(), is(equalTo(COLUMN_NAME)));
          assertThat("The column type is not correct.", schemaColumns.get(0).getType(), is(equalTo(NUMERIC_TYPE_NAME)));
          assertThat("The column size is not correct.", schemaColumns.get(0).getSize(), is(equalTo(SCHEMA_COLUMNS_SIZE)));
          assertThat("The required column is not correct.", schemaColumns.get(0).isRequired(), is(equalTo(REQUIRED)));
          assertThat("The column default value is not correct.", schemaColumns.get(0).getDefaultValue(), is(equalTo(COLUMN_DEFAULT_VALUE)));
  
          // Validate the mock calls.
          verify(resultSetMock, times(2)).next();
          verify(resultSetMock).getString("COLUMN_NAME");
          verify(resultSetMock, times(2)).getString("TYPE_NAME");
          verify(resultSetMock).getString("COLUMN_SIZE");
          verify(resultSetMock, times(2)).getString("DECIMAL_DIGITS");
          verify(resultSetMock).getInt("NULLABLE");
          verify(resultSetMock).getString("COLUMN_DEF");
          verifyNoMoreInteractions(resultSetMock);
      }
test_case.class_method_signature: RelationalTableRegistrationHelperTest.testGetSchemaColumns()
test_case.full_signature: @Test public void testGetSchemaColumns()
test_case.identifier: testGetSchemaColumns
test_case.invocations: mock thenReturn thenReturn when next thenReturn when getString thenReturn when getString thenReturn when getString thenReturn when getString thenReturn when getInt thenReturn when getString getSchemaColumns assertThat size is equalTo assertThat getName get is equalTo assertThat getType get is equalTo assertThat getSize get is equalTo assertThat isRequired get is equalTo assertThat getDefaultValue get is equalTo next verify times getString verify getString verify times getString verify getString verify times getInt verify getString verify verifyNoMoreInteractions
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testGetSchemaColumns()
focal_class.file: herd-code/herd-service/src/main/java/org/finra/herd/service/helper/RelationalTableRegistrationHelper.java
focal_class.identifier: RelationalTableRegistrationHelper
focal_class.class_method_signature: RelationalTableRegistrationHelper.getSchemaColumns(final ResultSet resultSet)
focal_class.full_signature: public List<SchemaColumn> getSchemaColumns(final ResultSet resultSet)
focal_class.identifier: getSchemaColumns
focal_class.modifiers: public
focal_class.parameters: (final ResultSet resultSet)
focal_class.return: List<SchemaColumn>
focal_class.signature: List<SchemaColumn> getSchemaColumns(final ResultSet resultSet)
focal_method.body: public List<SchemaColumn> getSchemaColumns(final ResultSet resultSet) throws SQLException
      {
          // Create an empty schema columns list.
          List<SchemaColumn> schemaColumns = new ArrayList<>();
  
          // While there are further results in the result set create a new schema column and add it to the list.
          while (resultSet.next())
          {
              SchemaColumn schemaColumn = new SchemaColumn();
              schemaColumn.setName(resultSet.getString("COLUMN_NAME"));
              schemaColumn.setType(resultSet.getString("TYPE_NAME"));
  
              // If this is a numeric column then include the decimal digits as part of the size.
              if (resultSet.getString("TYPE_NAME").equalsIgnoreCase("NUMERIC")
                  && StringUtils.isNotEmpty(resultSet.getString("DECIMAL_DIGITS")))
              {
                  schemaColumn.setSize(resultSet.getString("COLUMN_SIZE") + "," + resultSet.getString("DECIMAL_DIGITS"));
              }
              else
              {
                  schemaColumn.setSize(resultSet.getString("COLUMN_SIZE"));
              }
  
              schemaColumn.setRequired(resultSet.getInt("NULLABLE") == 0);
              schemaColumn.setDefaultValue(resultSet.getString("COLUMN_DEF"));
              schemaColumns.add(schemaColumn);
          }
  
          return schemaColumns;
      }
focal_method.class_method_signature: RelationalTableRegistrationHelper.getSchemaColumns(final ResultSet resultSet)
focal_method.full_signature: public List<SchemaColumn> getSchemaColumns(final ResultSet resultSet)
focal_method.identifier: getSchemaColumns
focal_method.invocations: next setName getString setType getString equalsIgnoreCase getString isNotEmpty getString setSize getString getString setSize getString setRequired getInt setDefaultValue getString add
focal_method.modifiers: public
focal_method.parameters: (final ResultSet resultSet)
focal_method.return: List<SchemaColumn>
focal_method.signature: List<SchemaColumn> getSchemaColumns(final ResultSet resultSet)