Github user MikeThomsen commented on a diff in the pull request:

    https://github.com/apache/nifi/pull/2745#discussion_r191389306
  
    --- Diff: 
nifi-nar-bundles/nifi-standard-services/nifi-lookup-services-bundle/nifi-lookup-services/src/test/java/org/apache/nifi/lookup/TestSimpleCsvFileLookupService.java
 ---
    @@ -64,4 +64,28 @@ public void testSimpleCsvFileLookupService() throws 
InitializationException, IOE
             assertEquals(EMPTY_STRING, property3);
         }
     
    +    @Test
    +    public void testSimpleCsvFileLookupServiceWithCharset() throws 
InitializationException, IOException, LookupFailureException {
    +        final TestRunner runner = 
TestRunners.newTestRunner(TestProcessor.class);
    +        final SimpleCsvFileLookupService service = new 
SimpleCsvFileLookupService();
    +
    +        runner.addControllerService("csv-file-lookup-service", service);
    +        runner.setProperty(service, SimpleCsvFileLookupService.CSV_FILE, 
"src/test/resources/test_Windows-31J.csv");
    +        runner.setProperty(service, SimpleCsvFileLookupService.CSV_FORMAT, 
"RFC4180");
    +        runner.setProperty(service, SimpleCsvFileLookupService.CHARSET, 
"Windows-31J");
    +        runner.setProperty(service, 
SimpleCsvFileLookupService.LOOKUP_KEY_COLUMN, "key");
    +        runner.setProperty(service, 
SimpleCsvFileLookupService.LOOKUP_VALUE_COLUMN, "value");
    +        runner.enableControllerService(service);
    +        runner.assertValid(service);
    +
    +        final SimpleCsvFileLookupService lookupService =
    +                (SimpleCsvFileLookupService) runner.getProcessContext()
    +                        .getControllerServiceLookup()
    +                        .getControllerService("csv-file-lookup-service");
    +
    +        assertThat(lookupService, instanceOf(LookupService.class));
    +
    +        final Optional<String> property1 = 
lookupService.lookup(Collections.singletonMap("key", "property.1"));
    +        assertEquals(Optional.of("this is property \uff11"), property1);
    --- End diff --
    
    Add `assertTrue(property1.isPresent())` so the test will cleanly fail the 
evaluation if it's not present.


---

Reply via email to