Search in sources :

Example 1 with Concept

use of org.pentaho.metadata.model.concept.Concept in project pentaho-kettle by pentaho.

the class ConceptUtilTest method testGetString.

@Test
public void testGetString() throws Exception {
    final Concept concept = mock(Concept.class);
    final String id = "id";
    final String result = "result";
    when(concept.getProperty(eq(id))).thenReturn(result);
    final String string = ConceptUtil.getString(concept, id);
    assertEquals(result, string);
}
Also used : Concept(org.pentaho.metadata.model.concept.Concept) Matchers.anyString(org.mockito.Matchers.anyString) LocalizedString(org.pentaho.metadata.model.concept.types.LocalizedString) Test(org.junit.Test)

Example 2 with Concept

use of org.pentaho.metadata.model.concept.Concept in project pentaho-kettle by pentaho.

the class ConceptUtilTest method testGetTableTypeConcept.

@Test
public void testGetTableTypeConcept() throws Exception {
    final Concept concept = mock(Concept.class);
    TableType tableType = ConceptUtil.getTableType(concept);
    assertEquals(TableType.OTHER, tableType);
    final TableType result = TableType.FACT;
    when(concept.getProperty(eq(DefaultPropertyID.TABLE_TYPE.getId()))).thenReturn(result);
    tableType = ConceptUtil.getTableType(concept);
    assertEquals(result, tableType);
}
Also used : Concept(org.pentaho.metadata.model.concept.Concept) TableType(org.pentaho.metadata.model.concept.types.TableType) Test(org.junit.Test)

Example 3 with Concept

use of org.pentaho.metadata.model.concept.Concept in project pentaho-kettle by pentaho.

the class ConceptUtilTest method testGetName.

@Test
public void testGetName() throws Exception {
    final Concept concept = mock(Concept.class);
    final LocalizedString localizedString = mock(LocalizedString.class);
    final String result = "result";
    when(localizedString.getLocalizedString(eq(locale))).thenReturn(result);
    when(concept.getProperty(anyString())).thenReturn(localizedString);
    final String name = ConceptUtil.getName(concept, locale);
    verify(localizedString, times(1)).getLocalizedString(eq(locale));
    assertEquals(result, name);
}
Also used : Concept(org.pentaho.metadata.model.concept.Concept) Matchers.anyString(org.mockito.Matchers.anyString) LocalizedString(org.pentaho.metadata.model.concept.types.LocalizedString) LocalizedString(org.pentaho.metadata.model.concept.types.LocalizedString) Test(org.junit.Test)

Example 4 with Concept

use of org.pentaho.metadata.model.concept.Concept in project pentaho-kettle by pentaho.

the class ConceptUtilTest method testGetDescription.

@Test
public void testGetDescription() throws Exception {
    final Concept concept = mock(Concept.class);
    final LocalizedString localizedString = mock(LocalizedString.class);
    final String result = "result";
    when(localizedString.getLocalizedString(eq(locale))).thenReturn(result);
    when(concept.getProperty(anyString())).thenReturn(localizedString);
    final String description = ConceptUtil.getDescription(concept, locale);
    verify(localizedString, times(1)).getLocalizedString(eq(locale));
    assertEquals(result, description);
}
Also used : Concept(org.pentaho.metadata.model.concept.Concept) Matchers.anyString(org.mockito.Matchers.anyString) LocalizedString(org.pentaho.metadata.model.concept.types.LocalizedString) LocalizedString(org.pentaho.metadata.model.concept.types.LocalizedString) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)4 Concept (org.pentaho.metadata.model.concept.Concept)4 Matchers.anyString (org.mockito.Matchers.anyString)3 LocalizedString (org.pentaho.metadata.model.concept.types.LocalizedString)3 TableType (org.pentaho.metadata.model.concept.types.TableType)1