• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

coditory / quark-i18n / #12

pending completion
#12

push

github-actions

ogesaku
Expand localized messages api

22 of 22 new or added lines in 3 files covered. (100.0%)

1596 of 2144 relevant lines covered (74.44%)

0.74 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

36.11
/src/main/java/com/coditory/quark/i18n/I18nMessages.java
1
package com.coditory.quark.i18n;
2

3
import org.jetbrains.annotations.NotNull;
4
import org.jetbrains.annotations.Nullable;
5

6
import java.util.Locale;
7
import java.util.Map;
8

9
import static com.coditory.quark.i18n.Preconditions.expectNonBlank;
10
import static com.coditory.quark.i18n.Preconditions.expectNonNull;
11

12
public final class I18nMessages {
13
    static final Object[] EMPTY_ARGS = new Object[0];
1✔
14
    private final I18nMessagePack messagePack;
15
    private final Locale locale;
16

17
    I18nMessages(I18nMessagePack messagePack, Locale locale) {
1✔
18
        this.messagePack = expectNonNull(messagePack, "messagePack");
1✔
19
        this.locale = expectNonNull(locale, "locale");
1✔
20
    }
1✔
21

22
    @NotNull
23
    public String getMessage(@NotNull I18nPath path, Object... args) {
24
        expectNonNull(path, "path");
×
25
        expectNonNull(args, "args");
×
26
        return messagePack.getMessage(locale, path, args);
×
27
    }
28

29
    @Nullable
30
    public String getMessageOrNull(@NotNull I18nPath path, Object... args) {
31
        expectNonNull(path, "path");
×
32
        expectNonNull(args, "args");
×
33
        return messagePack.getMessageOrNull(locale, path, args);
×
34
    }
35

36
    @NotNull
37
    public String getMessage(@NotNull I18nPath path) {
38
        expectNonNull(path, "path");
×
39
        return messagePack.getMessage(locale, path);
×
40
    }
41

42
    @Nullable
43
    public String getMessageOrNull(@NotNull I18nPath path) {
44
        expectNonNull(path, "path");
×
45
        return messagePack.getMessageOrNull(locale, path);
×
46
    }
47

48
    @NotNull
49
    public String getMessage(@NotNull String key, Object... args) {
50
        expectNonBlank(key, "key");
1✔
51
        expectNonNull(args, "args");
1✔
52
        return messagePack.getMessage(locale, key, args);
1✔
53
    }
54

55
    @Nullable
56
    public String getMessageOrNull(@NotNull String key, Object... args) {
57
        expectNonBlank(key, "key");
×
58
        expectNonNull(args, "args");
×
59
        return messagePack.getMessageOrNull(locale, key, args);
×
60
    }
61

62
    @NotNull
63
    public String getMessage(@NotNull String key, @NotNull Map<String, Object> args) {
64
        expectNonBlank(key, "key");
1✔
65
        expectNonNull(args, "args");
1✔
66
        return messagePack.getMessage(locale, key, args);
1✔
67
    }
68

69
    @Nullable
70
    public String getMessageOrNull(@NotNull String key, @NotNull Map<String, Object> args) {
71
        expectNonBlank(key, "key");
×
72
        expectNonNull(args, "args");
×
73
        return messagePack.getMessageOrNull(locale, key, args);
×
74
    }
75

76
    @NotNull
77
    public String getMessage(@NotNull String key) {
78
        expectNonNull(key, "key");
1✔
79
        return getMessage(key, EMPTY_ARGS);
1✔
80
    }
81

82
    @Nullable
83
    public String getMessageOrNull(@NotNull String key) {
84
        expectNonBlank(key, "key");
×
85
        return messagePack.getMessageOrNull(locale, key);
×
86
    }
87

88
    @NotNull
89
    public I18nMessages prefixQueries(@NotNull String prefix) {
90
        return messagePack.prefixQueries(prefix).localize(locale);
×
91
    }
92

93
    @NotNull
94
    public String format(@NotNull String template, Object... args) {
95
        expectNonNull(template, "template");
×
96
        expectNonNull(args, "args");
×
97
        return messagePack.format(locale, template, args);
×
98
    }
99

100
    @NotNull
101
    public Locale getLocale() {
102
        return locale;
×
103
    }
104
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc