@Test public void testSetFieldName() throws Exception { assertNull(setSessionVariableMeta.getFieldName()); String[] fieldName = new String[] {"value1", "value2"}; setSessionVariableMeta.setFieldName(fieldName); assertEquals(fieldName, setSessionVariableMeta.getFieldName()); }
@Test public void testClone() throws Exception { setSessionVariableMetaSpy.setFieldName(new String[] {"1"}); setSessionVariableMetaSpy.setVariableName(new String[] {"2"}); setSessionVariableMetaSpy.setDefaultValue(new String[] {"3"}); SetSessionVariableMeta clone = (SetSessionVariableMeta) setSessionVariableMetaSpy.clone(); doReturn(clone).when(setSessionVariableMetaSpy).clone(); verify(clone, times(1)).allocate(1); }
@Test public void testGetXML() { setSessionVariableMeta.allocate(1); setSessionVariableMeta.setFieldName(new String[] {"fn"}); final String xml = setSessionVariableMeta.getXML(); assertNotNull(xml); assertTrue(xml.contains("fields")); assertTrue(xml.contains("field")); assertTrue(xml.contains("name")); assertTrue(xml.contains("variable")); assertTrue(xml.contains("default_value")); assertTrue(xml.contains("use_formatting")); }
@Test public void testSaveRep() throws Exception { final Repository rep = mock(Repository.class); final IMetaStore metaStore = mock(IMetaStore.class); final ObjectId id_step = mock(ObjectId.class); final ObjectId id_transformation = mock(ObjectId.class); setSessionVariableMeta.allocate(1); setSessionVariableMeta.setFieldName(new String[] {"fn"}); setSessionVariableMeta.saveRep(rep, metaStore, id_transformation, id_step); verify(rep, times(3)) .saveStepAttribute(eq(id_transformation), eq(id_step), anyInt(), anyString(), anyString()); verify(rep) .saveStepAttribute(eq(id_transformation), eq(id_step), anyInt(), anyString(), anyBoolean()); }