コード例 #1
0
  public void testJSLibsInvalidTimezone() throws Exception {
    try {
      AuraLocale auraLocale = new AuraLocaleImpl(Locale.US, TimeZone.getTimeZone("HammerTime"));
      LocalizationAdapter mockAdapter = mock(LocalizationAdapter.class);
      when(mockAdapter.getAuraLocale()).thenReturn(auraLocale);
      ServiceLoader locator = ServiceLocatorMocker.spyOnServiceLocator();
      when(locator.get(LocalizationAdapter.class)).thenReturn(mockAdapter);

      startAppContext("<aura:application></aura:application>");

      assertTrue(
          "JS libs file should be the default libs_GMT.js for invalid timezones",
          Aura.getConfigAdapter().getJSLibsURL().contains("libs_GMT.js"));
    } finally {
      ServiceLocatorMocker.unmockServiceLocator();
    }
  }
コード例 #2
0
  public void testJSLibsEqualivalentTimezone() throws Exception {
    try {
      AuraLocale auraLocale = new AuraLocaleImpl(Locale.US, TimeZone.getTimeZone("US/Pacific"));
      LocalizationAdapter mockAdapter = mock(LocalizationAdapter.class);
      when(mockAdapter.getAuraLocale()).thenReturn(auraLocale);
      ServiceLoader locator = ServiceLocatorMocker.spyOnServiceLocator();
      when(locator.get(LocalizationAdapter.class)).thenReturn(mockAdapter);

      startAppContext("<aura:application></aura:application>");

      assertTrue(
          "JS libs file should be libs_America-Los-Angeles.js",
          Aura.getConfigAdapter().getJSLibsURL().contains("libs_America-Los_Angeles.js"));
    } finally {
      ServiceLocatorMocker.unmockServiceLocator();
    }
  }