本文整理匯總了Java中org.springframework.boot.configurationsample.fieldvalues.FieldValues類的典型用法代碼示例。如果您正苦於以下問題:Java FieldValues類的具體用法?Java FieldValues怎麽用?Java FieldValues使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
FieldValues類屬於org.springframework.boot.configurationsample.fieldvalues包,在下文中一共展示了FieldValues類的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getFieldValues
import org.springframework.boot.configurationsample.fieldvalues.FieldValues; //導入依賴的package包/類
@Test
public void getFieldValues() throws Exception {
TestProcessor processor = new TestProcessor();
TestCompiler compiler = new TestCompiler(this.temporaryFolder);
compiler.getTask(FieldValues.class).call(processor);
Map<String, Object> values = processor.getValues();
assertThat(values.get("string")).isEqualTo("1");
assertThat(values.get("stringNone")).isNull();
assertThat(values.get("stringConst")).isEqualTo("c");
assertThat(values.get("bool")).isEqualTo(true);
assertThat(values.get("boolNone")).isEqualTo(false);
assertThat(values.get("boolConst")).isEqualTo(true);
assertThat(values.get("boolObject")).isEqualTo(true);
assertThat(values.get("boolObjectNone")).isNull();
assertThat(values.get("boolObjectConst")).isEqualTo(true);
assertThat(values.get("integer")).isEqualTo(1);
assertThat(values.get("integerNone")).isEqualTo(0);
assertThat(values.get("integerConst")).isEqualTo(2);
assertThat(values.get("integerObject")).isEqualTo(3);
assertThat(values.get("integerObjectNone")).isNull();
assertThat(values.get("integerObjectConst")).isEqualTo(4);
assertThat(values.get("charset")).isEqualTo("US-ASCII");
assertThat(values.get("charsetConst")).isEqualTo("UTF-8");
assertThat(values.get("mimeType")).isEqualTo("text/html");
assertThat(values.get("mimeTypeConst")).isEqualTo("text/plain");
assertThat(values.get("object")).isEqualTo(123);
assertThat(values.get("objectNone")).isNull();
assertThat(values.get("objectConst")).isEqualTo("c");
assertThat(values.get("objectInstance")).isNull();
assertThat(values.get("stringArray")).isEqualTo(new Object[] { "FOO", "BAR" });
assertThat(values.get("stringArrayNone")).isNull();
assertThat(values.get("stringEmptyArray")).isEqualTo(new Object[0]);
assertThat(values.get("stringArrayConst")).isEqualTo(new Object[] { "OK", "KO" });
assertThat(values.get("stringArrayConstElements"))
.isEqualTo(new Object[] { "c" });
assertThat(values.get("integerArray")).isEqualTo(new Object[] { 42, 24 });
assertThat(values.get("unknownArray")).isNull();
}
開發者ID:vikrammane23,項目名稱:https-github.com-g0t4-jenkins2-course-spring-boot,代碼行數:39,代碼來源:AbstractFieldValuesProcessorTests.java
示例2: getFieldValues
import org.springframework.boot.configurationsample.fieldvalues.FieldValues; //導入依賴的package包/類
@Test
public void getFieldValues() throws Exception {
TestProcessor processor = new TestProcessor();
TestCompiler compiler = new TestCompiler(this.temporaryFolder);
compiler.getTask(FieldValues.class).call(processor);
Map<String, Object> values = processor.getValues();
assertThat(values.get("string"), equalToObject("1"));
assertThat(values.get("stringNone"), nullValue());
assertThat(values.get("stringConst"), equalToObject("c"));
assertThat(values.get("bool"), equalToObject(true));
assertThat(values.get("boolNone"), equalToObject(false));
assertThat(values.get("boolConst"), equalToObject(true));
assertThat(values.get("boolObject"), equalToObject(true));
assertThat(values.get("boolObjectNone"), nullValue());
assertThat(values.get("boolObjectConst"), equalToObject(true));
assertThat(values.get("integer"), equalToObject(1));
assertThat(values.get("integerNone"), equalToObject(0));
assertThat(values.get("integerConst"), equalToObject(2));
assertThat(values.get("integerObject"), equalToObject(3));
assertThat(values.get("integerObjectNone"), nullValue());
assertThat(values.get("integerObjectConst"), equalToObject(4));
assertThat(values.get("charset"), equalToObject("US-ASCII"));
assertThat(values.get("charsetConst"), equalToObject("UTF-8"));
assertThat(values.get("mimeType"), equalToObject("text/html"));
assertThat(values.get("mimeTypeConst"), equalToObject("text/plain"));
assertThat(values.get("object"), equalToObject(123));
assertThat(values.get("objectNone"), nullValue());
assertThat(values.get("objectConst"), equalToObject("c"));
assertThat(values.get("objectInstance"), nullValue());
assertThat(values.get("stringArray"),
equalToObject(new Object[] { "FOO", "BAR" }));
assertThat(values.get("stringArrayNone"), nullValue());
assertThat(values.get("stringEmptyArray"), equalToObject(new Object[0]));
assertThat(values.get("stringArrayConst"),
equalToObject(new Object[] { "OK", "KO" }));
assertThat(values.get("stringArrayConstElements"),
equalToObject(new Object[] { "c" }));
assertThat(values.get("integerArray"), equalToObject(new Object[] { 42, 24 }));
assertThat(values.get("unknownArray"), nullValue());
}