Merge pull request #8935 from sergio41/master

[BAEL-3910] Code Upload
This commit is contained in:
Greg 2020-03-26 14:32:22 -04:00 committed by GitHub
commit 566c18ad7e
3 changed files with 40 additions and 0 deletions

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,38 @@
package com.baeldung.stringtoolong;
import static org.assertj.core.api.Assertions.assertThat;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;
import org.apache.commons.io.IOUtils;
import org.junit.Test;
public class StringTooLongUnitTest {
@Test
public void whenDeclaringTooLongString_thenCompilationError() {
String stringTooLong = "<string too long>";
assertThat(stringTooLong).isNotEmpty();
}
@Test
public void whenStoringInFileTooLongString_thenNoCompilationError() throws IOException {
FileInputStream fis = new FileInputStream("src/test/resources/stringtoolong.txt");
String stringTooLong = IOUtils.toString(fis, "UTF-8");
assertThat(stringTooLong).isNotEmpty();
}
@Test
public void whenStoringInPropertiesString_thenNoCompilationError() throws IOException {
String sValue = null;
try (InputStream input = new FileInputStream("src/main/resources/config.properties")) {
Properties prop = new Properties();
prop.load(input);
sValue = prop.getProperty("string.too.long");
}
assertThat(sValue).isNotEmpty();
}
}

File diff suppressed because one or more lines are too long