use of org.mule.runtime.api.metadata.DataType in project mule by mulesoft.
the class DataTypeBuilderTestCase method invalidMimeType.
@Test
public void invalidMimeType() {
expected.expect(IllegalArgumentException.class);
final DataType dataType = DataType.builder().mediaType("imInvalid").build();
}
use of org.mule.runtime.api.metadata.DataType in project mule by mulesoft.
the class DataTypeBuilderTestCase method invalidEncoding.
@Test
public void invalidEncoding() {
expected.expect(IllegalArgumentException.class);
final DataType dataType = DataType.builder().charset("imInvalid").build();
}
use of org.mule.runtime.api.metadata.DataType in project mule by mulesoft.
the class DataTypeBuilderTestCase method buildTypedCollectionFromImplementationClass.
@Test
public void buildTypedCollectionFromImplementationClass() {
final DataType dataType = DataType.builder().collectionType(SpecificCollection.class).build();
assertThat(dataType, instanceOf(DefaultCollectionDataType.class));
assertThat(dataType.getType(), is(equalTo(SpecificCollection.class)));
assertThat(((DefaultCollectionDataType) dataType).getItemDataType(), is(STRING));
}
use of org.mule.runtime.api.metadata.DataType in project mule by mulesoft.
the class DataTypeBuilderTestCase method cglibInterfaceProxy.
@Test
public void cglibInterfaceProxy() {
final Message muleMessageProxy = mock(Message.class);
final DataType dataType = DataType.fromObject(muleMessageProxy);
assertThat(dataType.getType(), is(equalTo(Message.class)));
}
use of org.mule.runtime.api.metadata.DataType in project mule by mulesoft.
the class DataTypeBuilderTestCase method buildMap.
@Test
public void buildMap() {
final DataType dataType = DataType.fromType(HashMap.class);
assertThat(dataType, instanceOf(DefaultMapDataType.class));
assertThat(dataType.getType(), is(equalTo(HashMap.class)));
assertThat(((DefaultMapDataType) dataType).getKeyDataType(), is(OBJECT));
assertThat(((DefaultMapDataType) dataType).getValueDataType(), is(OBJECT));
}
Aggregations