Search in sources :

Example 1 with StringProperty

use of ch.jalu.configme.properties.StringProperty in project AuthMeReloaded by AuthMe.

the class MigraterYamlFileResourceTest method shouldWriteWithCorrectCharset.

@Test
public void shouldWriteWithCorrectCharset() throws IOException {
    // given
    File file = temporaryFolder.newFile();
    Files.copy(TestHelper.getJarFile(CHINESE_MESSAGES_FILE), file);
    MigraterYamlFileResource resource = new MigraterYamlFileResource(file);
    ConfigurationData configurationData = buildConfigurationData();
    configurationData.initializeValues(resource.createReader());
    String newMessage = "您当前并没有任何邮箱与该账号绑定";
    configurationData.setValue(new StringProperty("third", ""), newMessage);
    // when
    resource.exportProperties(configurationData);
    // then
    PropertyReader reader = resource.createReader();
    assertThat(reader.getString("first"), equalTo("错误的密码"));
    assertThat(reader.getString("second"), equalTo("为了验证您的身份,您需要将一个电子邮件地址与您的帐户绑定!"));
    assertThat(reader.getString("third"), equalTo(newMessage));
}
Also used : ConfigurationData(ch.jalu.configme.configurationdata.ConfigurationData) StringProperty(ch.jalu.configme.properties.StringProperty) PropertyReader(ch.jalu.configme.resource.PropertyReader) File(java.io.File) Test(org.junit.Test)

Aggregations

ConfigurationData (ch.jalu.configme.configurationdata.ConfigurationData)1 StringProperty (ch.jalu.configme.properties.StringProperty)1 PropertyReader (ch.jalu.configme.resource.PropertyReader)1 File (java.io.File)1 Test (org.junit.Test)1