use of cn.taketoday.origin.Origin in project today-framework by TAKETODAY.
the class ConfigDataLocationTests method withOriginSetsOrigin.
@Test
void withOriginSetsOrigin() {
Origin origin = mock(Origin.class);
ConfigDataLocation location = ConfigDataLocation.valueOf("test").withOrigin(origin);
assertThat(location.getOrigin()).isSameAs(origin);
}
use of cn.taketoday.origin.Origin in project today-framework by TAKETODAY.
the class ConfigDataLocationTests method getOriginWhenWithOriginReturnsOrigin.
@Test
void getOriginWhenWithOriginReturnsOrigin() {
Origin origin = mock(Origin.class);
ConfigDataLocation location = ConfigDataLocation.valueOf("test").withOrigin(origin);
assertThat(location.getOrigin()).isSameAs(origin);
}
use of cn.taketoday.origin.Origin in project today-framework by TAKETODAY.
the class ConfigurationPropertyTests method getPropertyOriginShouldReturnValuePropertyOrigin.
@Test
void getPropertyOriginShouldReturnValuePropertyOrigin() {
Origin origin = mock(Origin.class);
OriginProvider property = ConfigurationProperty.of(this.source, NAME, "foo", origin);
assertThat(property.getOrigin()).isEqualTo(origin);
}
use of cn.taketoday.origin.Origin in project today-framework by TAKETODAY.
the class BindValidationFailureAnalyzer method appendFieldError.
private void appendFieldError(StringBuilder description, FieldError error) {
Origin origin = Origin.from(error);
description.append(String.format("%n Property: %s", error.getObjectName() + "." + error.getField()));
description.append(String.format("%n Value: %s", error.getRejectedValue()));
if (origin != null) {
description.append(String.format("%n Origin: %s", origin));
}
}
use of cn.taketoday.origin.Origin in project today-framework by TAKETODAY.
the class OriginTrackedPropertiesLoader method loadValue.
private OriginTrackedValue loadValue(StringBuilder buffer, CharacterReader reader, boolean splitLists) throws IOException {
buffer.setLength(0);
while (reader.isWhiteSpace() && !reader.isEndOfLine()) {
reader.read();
}
Location location = reader.getLocation();
while (!reader.isEndOfLine() && !(splitLists && reader.isListDelimiter())) {
buffer.append(reader.getCharacter());
reader.read();
}
Origin origin = new TextResourceOrigin(this.resource, location);
return OriginTrackedValue.of(buffer.toString(), origin);
}
Aggregations