@Test public void testGetUsedFields() throws Exception { Set<StepField> fields = new HashSet<>(); fields.add(new StepField("prev", "splitField")); doReturn(fields).when(analyzer).createStepFields(anyString(), any(StepNodes.class)); Set<StepField> usedFields = analyzer.getUsedFields(meta); int expectedUsedFieldCount = 1; assertEquals(expectedUsedFieldCount, usedFields.size()); verify(analyzer, times(expectedUsedFieldCount)) .createStepFields(anyString(), any(StepNodes.class)); }
@Test public void testGetChangeRecords() throws Exception { Set<ComponentDerivationRecord> changeRecords = analyzer.getChangeRecords(meta); assertEquals(3, changeRecords.size()); for (ComponentDerivationRecord changeRecord : changeRecords) { assertEquals("splitField", changeRecord.getOriginalEntityName()); assertTrue(ArrayUtils.contains(outputFields, changeRecord.getChangedEntityName())); Operations operations = changeRecord.getOperations(); assertEquals(1, operations.size()); // Only data operations List<IOperation> dataOperations = operations.get(ChangeType.DATA); assertEquals(1, dataOperations.size()); } }
@Test public void testCustomAnalyze() throws Exception { analyzer.customAnalyze(meta, node); verify(node).setProperty(eq(DictionaryConst.PROPERTY_DELIMITER), anyString()); verify(node).setProperty(eq(DictionaryConst.PROPERTY_ENCLOSURE), anyString()); }
@Test public void testGetSupportedSteps() throws Exception { Set<Class<? extends BaseStepMeta>> supportedSteps = analyzer.getSupportedSteps(); assertEquals(1, supportedSteps.size()); assertEquals(FieldSplitterMeta.class, supportedSteps.iterator().next()); }