This is an automated email from the ASF dual-hosted git repository.

solomax pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/openmeetings.git


The following commit(s) were added to refs/heads/master by this push:
     new 8476b3f  [OPENMEETINGS-2462] test is improved
8476b3f is described below

commit 8476b3fabe3f23d129c1182f6c4f60a9e3bfe05c
Author: Maxim Solodovnik <solomax...@gmail.com>
AuthorDate: Mon Sep 28 20:57:52 2020 +0700

    [OPENMEETINGS-2462] test is improved
---
 .../openmeetings/calendar/TestSendIcalMessage.java       | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)

diff --git 
a/openmeetings-web/src/test/java/org/apache/openmeetings/calendar/TestSendIcalMessage.java
 
b/openmeetings-web/src/test/java/org/apache/openmeetings/calendar/TestSendIcalMessage.java
index d255bed..6b72e3b 100644
--- 
a/openmeetings-web/src/test/java/org/apache/openmeetings/calendar/TestSendIcalMessage.java
+++ 
b/openmeetings-web/src/test/java/org/apache/openmeetings/calendar/TestSendIcalMessage.java
@@ -21,7 +21,8 @@ package org.apache.openmeetings.calendar;
 import static java.util.UUID.randomUUID;
 import static 
org.apache.openmeetings.util.OpenmeetingsVariables.getApplicationName;
 import static 
org.apache.openmeetings.util.OpenmeetingsVariables.setApplicationName;
-import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
 
 import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
@@ -32,6 +33,9 @@ import java.util.GregorianCalendar;
 import java.util.List;
 import java.util.Locale;
 import java.util.Map;
+import java.util.Map.Entry;
+import java.util.Random;
+import java.util.stream.Collectors;
 
 import javax.activation.DataHandler;
 import javax.mail.BodyPart;
@@ -45,6 +49,7 @@ import javax.mail.internet.MimeMultipart;
 
 import org.apache.openmeetings.AbstractJUnitDefaults;
 import org.apache.openmeetings.core.mail.MailHandler;
+import org.apache.openmeetings.db.dao.label.LabelDao;
 import org.apache.openmeetings.util.mail.ByteArrayDataSource;
 import org.apache.openmeetings.util.mail.IcalHandler;
 import org.junit.jupiter.api.Test;
@@ -236,10 +241,15 @@ class TestSendIcalMessage extends AbstractJUnitDefaults {
 
        @Test
        void testTeamLbl() {
+               final String newAppName = "AAAAA";
                final String prevAppName = getApplicationName();
                try {
-                       setApplicationName("AAA");
-                       assertEquals("AAA-Team", app.getOmString("511", 
Locale.ENGLISH));
+                       setApplicationName(newAppName);
+                       List<Locale> locales = 
LabelDao.getLanguages().stream().map(Entry::getValue).collect(Collectors.toList());
+                       Locale l = locales.get(new 
Random().nextInt(locales.size()));
+                       final String str = app.getOmString("511", l);
+                       assertNotNull(str);
+                       assertTrue(str.contains(newAppName));
                } finally {
                        setApplicationName(prevAppName);
                }

Reply via email to