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

openmrs / openmrs-core / 17991776982

24 Sep 2025 10:53PM UTC coverage: 64.928% (-0.05%) from 64.977%
17991776982

push

github

dkayiwa
TRUNK-6433 add isObsValueCodedAnswer method

7 of 10 new or added lines in 1 file covered. (70.0%)

21 existing lines in 9 files now uncovered.

23421 of 36072 relevant lines covered (64.93%)

0.65 hits per line

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

0.0
/api/src/main/java/org/openmrs/messagesource/impl/DefaultMessageSourceServiceImpl.java
1
/**
2
 * This Source Code Form is subject to the terms of the Mozilla Public License,
3
 * v. 2.0. If a copy of the MPL was not distributed with this file, You can
4
 * obtain one at http://mozilla.org/MPL/2.0/. OpenMRS is also distributed under
5
 * the terms of the Healthcare Disclaimer located at http://openmrs.org/license.
6
 *
7
 * Copyright (C) OpenMRS Inc. OpenMRS is a registered trademark and the OpenMRS
8
 * graphic logo is a trademark of OpenMRS Inc.
9
 */
10
package org.openmrs.messagesource.impl;
11

12
import java.io.InputStream;
13
import java.util.Collection;
14
import java.util.Locale;
15
import java.util.Properties;
16
import java.util.Set;
17

18
import org.openmrs.messagesource.MessageSourceService;
19
import org.openmrs.messagesource.MutableMessageSource;
20
import org.openmrs.messagesource.PresentationMessage;
21
import org.openmrs.util.OpenmrsClassLoader;
22
import org.openmrs.util.OpenmrsUtil;
23
import org.springframework.context.MessageSource;
24
import org.springframework.context.MessageSourceResolvable;
25
import org.springframework.context.NoSuchMessageException;
26

27
/**
28
 * Loads messages from the default message properties file before spring starts up
29
 */
30
public class DefaultMessageSourceServiceImpl implements MessageSourceService {
31

UNCOV
32
        private Properties props = new Properties();
×
33
        
34
        /**
35
         * Private class to hold the one instance. This is an alternative to
36
         * storing the instance object on {@link DefaultMessageSourceServiceImpl} itself so that garbage collection
37
         * can happen correctly.
38
         */
39
        private static class DefaultMessageSourceServiceImplHolder {
40

41
                private DefaultMessageSourceServiceImplHolder() {
42
                }
43

UNCOV
44
                private static DefaultMessageSourceServiceImpl INSTANCE = null;
×
45
        }
46
        
47
        /**
48
         * Get the static/singular instance
49
         *
50
         * @return DefaultMessageSourceServiceImpl
51
         */
52
        public static DefaultMessageSourceServiceImpl getInstance() {
UNCOV
53
                if (DefaultMessageSourceServiceImplHolder.INSTANCE == null) {
×
UNCOV
54
                        DefaultMessageSourceServiceImplHolder.INSTANCE = new DefaultMessageSourceServiceImpl();
×
55
                }
56
                
UNCOV
57
                return DefaultMessageSourceServiceImplHolder.INSTANCE;
×
58
        }
59
        
UNCOV
60
        private DefaultMessageSourceServiceImpl() {
×
UNCOV
61
                InputStream stream = OpenmrsClassLoader.getInstance().getResourceAsStream("messages.properties");
×
UNCOV
62
                if (stream != null) {
×
UNCOV
63
                        OpenmrsUtil.loadProperties(props, stream);
×
64
                }
UNCOV
65
        }
×
66
        
67
        @Override
68
        public String getMessage(String code, Object[] args, String defaultMessage, Locale locale) {
69
                return getMessage(code);
×
70
        }
71

72
        @Override
73
        public String getMessage(String code, Object[] args, Locale locale) throws NoSuchMessageException {
UNCOV
74
                return getMessage(code);
×
75
        }
76
        
77
        @Override
78
        public String getMessage(String s) {
UNCOV
79
                return (String)props.get(s);
×
80
        }
81
        
82
        @Override
83
        public Collection<Locale> getLocales() {
84
                return null;
×
85
        }
86

87
        @Override
88
        public Collection<PresentationMessage> getPresentations() {
89
                return null;
×
90
        }
91

92
        @Override
93
        public Collection<PresentationMessage> getPresentationsInLocale(Locale locale) {
94
                return null;
×
95
        }
96

97
        @Override
98
        public void addPresentation(PresentationMessage message) {
99
                
100
        }
×
101

102
        @Override
103
        public PresentationMessage getPresentation(String key, Locale forLocale) {
104
                return null;
×
105
        }
106

107
        @Override
108
        public void removePresentation(PresentationMessage message) {
109
                
110
        }
×
111

112
        @Override
113
        public void merge(MutableMessageSource fromSource, boolean overwrite) {
114
                
115
        }
×
116

117
        @Override
118
        public String getMessage(MessageSourceResolvable resolvable, Locale locale) throws NoSuchMessageException {
119
                return null;
×
120
        }
121

122
        @Override
123
        public void setParentMessageSource(MessageSource parent) {
124
                
125
        }
×
126

127
        @Override
128
        public MessageSource getParentMessageSource() {
129
                return null;
×
130
        }
131

132
        @Override
133
        public MutableMessageSource getActiveMessageSource() {
134
                return null;
×
135
        }
136

137
        @Override
138
        public void setActiveMessageSource(MutableMessageSource activeMessageSource) {
139
                
140
        }
×
141

142
        @Override
143
        public Set<MutableMessageSource> getMessageSources() {
144
                return null;
×
145
        }
146

147
        @Override
148
        public void setMessageSources(Set<MutableMessageSource> availableMessageSources) {
149

150
        }
×
151
}
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