Skip to content

Commit de41d12

Browse files
committed
Adjust test & polishing
1 parent c9a3a4b commit de41d12

File tree

4 files changed

+21
-5
lines changed

4 files changed

+21
-5
lines changed

src/main/java/io/simplelocalize/cli/configuration/ConfigurationLoader.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
import java.io.InputStream;
1313
import java.io.UnsupportedEncodingException;
1414
import java.net.URLDecoder;
15+
import java.nio.charset.StandardCharsets;
1516
import java.nio.file.Path;
1617
import java.nio.file.Paths;
1718

@@ -21,12 +22,12 @@ public class ConfigurationLoader {
2122

2223
private Logger log = LoggerFactory.getLogger(ConfigurationLoader.class);
2324

24-
public Configuration load(String path) throws UnsupportedEncodingException {
25+
public Configuration load(String path) {
2526

2627
Path configurationFilePath = Paths.get(path);
2728
log.info("Using configuration file in path: {}", configurationFilePath);
2829

29-
File file = new File(URLDecoder.decode(String.valueOf(configurationFilePath.toFile()), "utf-8"));;
30+
File file = new File(URLDecoder.decode(String.valueOf(configurationFilePath.toFile()), StandardCharsets.UTF_8));
3031

3132
if (!file.exists()) {
3233
throw new ConfigurationNotFoundException("Could not find configuration file in: " + path);

src/main/java/io/simplelocalize/cli/util/FileReaderUtil.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public static List<String> tryReadLines(Path filePath) {
2828
Path decodedFilePath = null;
2929
List<String> fileLines = Collections.emptyList();
3030
try {
31-
decodedFilePath = Paths.get(URLDecoder.decode(String.valueOf(Paths.get(String.valueOf(filePath))), "utf-8"));
31+
decodedFilePath = Paths.get(URLDecoder.decode(String.valueOf(Paths.get(String.valueOf(filePath))), StandardCharsets.UTF_8));
3232
fileLines = Files.readAllLines(decodedFilePath, StandardCharsets.UTF_8);
3333
} catch (IOException e) {
3434
log.warn("Cannot read file from path " + decodedFilePath.toString(), e);
@@ -40,7 +40,7 @@ public static List<String> tryReadLines(Path filePath) {
4040
public static String tryReadContent(Path filePath) {
4141
Path decodedFilePath = null;
4242
try {
43-
decodedFilePath = Paths.get(URLDecoder.decode(String.valueOf(Paths.get(String.valueOf(filePath))), "utf-8"));
43+
decodedFilePath = Paths.get(URLDecoder.decode(String.valueOf(Paths.get(String.valueOf(filePath))), StandardCharsets.UTF_8));
4444
return Files.readString(decodedFilePath, StandardCharsets.UTF_8);
4545
} catch (IOException e) {
4646
log.warn("Cannot read file from path " + decodedFilePath.toString(), e);

src/test/java/io/simplelocalize/cli/processor/keys/ReactIntlKeyExtractorTest.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,16 @@ public void shouldExtractKeysFromLines() throws Exception {
2323
Set<String> keys = reactIntlKeyExtractor.extractKeysFromFile(Paths.get(path));
2424

2525
//then
26-
Assertions.assertThat(keys).hasSize(8);
26+
Assertions.assertThat(keys).hasSize(10);
2727
Assertions.assertThat(keys).containsExactlyInAnyOrder(
2828
"VISITS",
2929
"LIKES",
3030
"CREATED_COUNT",
3131
"COMMENTS",
3232
"COVER_IMAGE.PLACEHOLDER",
3333
"COVER_IMAGE.TITLE",
34+
"COVER_IMAGE.PLACEHOLDER_DOUBLE",
35+
"COVER_IMAGE.TITLE_DOUBLE",
3436
"ACHIEVEMENTS",
3537
"AVAILABLE_SOON"
3638
);

src/test/resources/react-intl/UserPage.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,19 @@ class UserPage extends Component {
197197
/> :
198198
null}
199199

200+
{showingLoggedUser ?
201+
<ImageUploaderGroup
202+
onImageUploaded={this.onCoverUploaded}
203+
title={intl.formatMessage(defineMessages({
204+
id: "COVER_IMAGE.TITLE_DOUBLE",
205+
defaultMessage: "Change cover photo"
206+
}))}
207+
message={intl.formatMessage(defineMessages( { id: "COVER_IMAGE.PLACEHOLDER_DOUBLE",
208+
defaultMessage: "Drop photo here, we will take care of everything"
209+
}))}
210+
/> :
211+
null}
212+
200213
<h2 className="text-center">
201214
<FormattedMessage
202215
id="ACHIEVEMENTS"

0 commit comments

Comments
 (0)