Afly
4 years ago
2 changed files with 65 additions and 6 deletions
@ -0,0 +1,35 @@ |
|||||||
|
package com.fr.third.joda.time.tz; |
||||||
|
|
||||||
|
import org.junit.Test; |
||||||
|
|
||||||
|
import java.io.IOException; |
||||||
|
import java.lang.reflect.InvocationTargetException; |
||||||
|
import java.lang.reflect.Method; |
||||||
|
|
||||||
|
import static org.junit.Assert.*; |
||||||
|
|
||||||
|
/** |
||||||
|
* @author Afly |
||||||
|
* created on 2020-12-16 |
||||||
|
*/ |
||||||
|
public class ZoneInfoProviderTest { |
||||||
|
|
||||||
|
@Test |
||||||
|
public void testGetResource() throws IOException, NoSuchMethodException { |
||||||
|
ZoneInfoProvider zoneInfoProvider = new ZoneInfoProvider(); |
||||||
|
assertNotNull(zoneInfoProvider.getZone("Etc/GMT+8")); |
||||||
|
Method openResource = zoneInfoProvider.getClass().getDeclaredMethod("openResource", String.class); |
||||||
|
openResource.setAccessible(true); |
||||||
|
try { |
||||||
|
openResource.invoke(zoneInfoProvider, "Etc/Exception+8"); |
||||||
|
fail(); |
||||||
|
} catch (Exception ignored) { |
||||||
|
} |
||||||
|
|
||||||
|
try { |
||||||
|
openResource.invoke(zoneInfoProvider, "Etc/Exception-8"); |
||||||
|
fail(); |
||||||
|
} catch (Exception ignored) { |
||||||
|
} |
||||||
|
} |
||||||
|
} |
Loading…
Reference in new issue