View Javadoc
1   /*
2    * Copyright (C) 2003-2015 eXo Platform SAS.
3    *
4    * This is free software; you can redistribute it and/or modify it
5    * under the terms of the GNU Lesser General Public License as
6    * published by the Free Software Foundation; either version 3 of
7    * the License, or (at your option) any later version.
8    *
9    * This software is distributed in the hope that it will be useful,
10   * but WITHOUT ANY WARRANTY; without even the implied warranty of
11   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12   * Lesser General Public License for more details.
13   *
14   * You should have received a copy of the GNU Lesser General Public
15   * License along with this software; if not, write to the Free
16   * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
17   * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
18   */
19  package org.exoplatform.mobile.tests;
20  
21  import static org.junit.Assert.assertEquals;
22  
23  import org.exoplatform.model.ExoFile;
24  import org.robolectric.annotation.Config;
25  
26  import android.os.Build;
27  
28  import org.junit.After;
29  import org.junit.Before;
30  import org.junit.Test;
31  import org.junit.runner.RunWith;
32  import org.robolectric.RobolectricTestRunner;
33  
34  /**
35   * Created by The eXo Platform SAS Author : Philippe Aristote
36   * paristote@exoplatform.com Apr 17, 2015
37   */
38  @RunWith(RobolectricTestRunner.class)
39  @Config(sdk=Build.VERSION_CODES.LOLLIPOP) // API LEVEL 21
40  public class ExoDocumentUtilsTest {
41  
42      @Before
43      public void setup() {
44      }
45  
46      @After
47      public void teardown() {
48      }
49  
50      @Test
51      public void testConvertTechnicalToNaturalNames() {
52  
53          final String[] technicalNames = { ".organization.employees", ".spaces.exo_fr",
54                  ".spaces.exo_mobile", ".platform.web-contributors", ".platform.users.managers",
55                  ".spaces.thu_muc_tieng_viet_100", ".spaces.aađoiec", "Âã-đô-ịẻç", ".élus.députés",
56                  ".spaces.my-spaces", ".spaces.spaces-for-admins", "日本語", "عربي عربى", "指事字",
57                  "λάμβδα", "אותיות השימוש" };
58  
59          final String[] naturalNames = { "Organization Employees", "eXo Fr", "eXo Mobile",
60                  "Platform Web Contributors", "Platform Users Managers", "Thu Muc Tieng Viet 100",
61                  "Aađoiec", "Âã Đô Ịẻç", "Élus Députés", "My Spaces", "Spaces For Admins", "日本語",
62                  "عربي عربى", "指事字", "Λάμβδα", "אותיות השימוש" };
63  
64          for (int i = 0; i < technicalNames.length; i++) {
65              String name = technicalNames[i];
66              ExoFile file = new ExoFile();
67              file.name = name;
68              file.createNaturalName();
69              assertEquals("Incorrect technical -> natural name conversion.",
70                           naturalNames[i],
71                           file.getName());
72          }
73  
74      }
75  
76      public void testGetDrivesFromHttpResponse() {
77          // TODO
78          // Test ExoDocumentUtils.getDrives(HttpResponse, boolean)
79      }
80  }