@Test
  public void testImportByConfig() {
    final ImpExResource mediaRes =
        new StreamBasedImpExResource(
            new ByteArrayInputStream("INSERT Language;isocode;active\n;test;true".getBytes()),
            CSVConstants.HYBRIS_ENCODING);

    final ImportConfig config = new ImportConfig();
    config.setScript(mediaRes);

    final ImportResult result = importService.importData(config);
    assertNotNull(result);
    assertTrue(result.isSuccessful());
    assertFalse(result.isError());
    assertFalse(result.hasUnresolvedLines());
    assertTrue(result.isFinished());
    assertNotNull("Language 'test' was not imported", getOrCreateLanguage("test"));
  }
  private void internalImportByConfigWithError(final boolean failOnError) {
    try {
      TestUtils.disableFileAnalyzer();
      final ImpExResource mediaRes =
          new StreamBasedImpExResource(
              new ByteArrayInputStream(
                  "UPDATE Language;isocode[unique=true];active\n;test;true".getBytes()),
              CSVConstants.HYBRIS_ENCODING);

      final ImportConfig config = new ImportConfig();
      config.setScript(mediaRes);
      config.setFailOnError(failOnError);

      final ImportResult result = importService.importData(config);
      assertNotNull(result);
      assertFalse(result.isSuccessful());
      assertTrue(result.isError());
      assertTrue(result.hasUnresolvedLines());
      assertNotNull(result.getUnresolvedLines());
      assertTrue(result.isFinished());
    } finally {
      TestUtils.enableFileAnalyzer();
    }
  }