/*
 * Copyright 2012 Ryuji Yamashita
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package facebook4j.internal.util;

import static org.hamcrest.CoreMatchers.*;
import static org.junit.Assert.*;

import java.util.Calendar;
import java.util.Date;
import java.util.TimeZone;

import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;

import facebook4j.internal.org.json.JSONObject;

public class z_F4JInternalStringUtilTest {

    @BeforeClass
    public static void setUpBeforeClass() throws Exception {
    }

    @AfterClass
    public static void tearDownAfterClass() throws Exception {
    }

    @Before
    public void setUp() throws Exception {
    }

    @After
    public void tearDown() throws Exception {
    }

    @Test
    public void join() {
        assertThat(z_F4JInternalStringUtil.join(new String[] {"foo"}, "&"), is("foo"));
        assertThat(z_F4JInternalStringUtil.join(new String[] {"foo", "bar", "baz"}, "&"), is("foo&bar&baz"));
    }

    @Test
    public void formatISO8601Datetime() throws Exception {
        Calendar cal = Calendar.getInstance();

        cal.setTimeZone(TimeZone.getTimeZone("JST"));
        String actual1 = z_F4JInternalStringUtil.formatISO8601Datetime(cal);
        System.out.println(actual1);
        assertThat(actual1.length(), is(24));

        cal.setTimeZone(TimeZone.getTimeZone("UTC"));
        String actual2 = z_F4JInternalStringUtil.formatISO8601Datetime(cal);
        System.out.println(actual2);
        assertThat(actual2.length(), is(24));
        
        JSONObject json = new JSONObject("{\"datetime1\": \"" + actual1 + "\", \"datetime2\": \"" + actual2 + "\"}");
        Date d1 = z_F4JInternalParseUtil.getISO8601Datetime("datetime1", json);
        Date d2 = z_F4JInternalParseUtil.getISO8601Datetime("datetime2", json);
        assertThat(d1, is(d2));
    }

}

@@ -640,42 +640,47 @@
 ort 
-static org.hamcrest.CoreMatchers.*
+facebook4j.internal.org.json.JSONObject
 ;%0Aim
@@ -684,23 +684,16 @@
 %0Aimport 
-static 
 org.juni
@@ -698,16 +698,12 @@
 nit.
-Assert.*
+Test
 ;%0A%0Ai
@@ -790,521 +790,121 @@
 ort 
-org.junit.After;%0Aimport org.junit.AfterClass;%0Aimport org.junit.Before;%0Aimport org.junit.BeforeClass;%0Aimport org.junit.Test;%0A%0Aimport facebook4j.internal.org.json.JSONObject;%0A%0Apublic class z_F4JInternalStringUtilTest %7B%0A%0A    @BeforeClass%0A    public static void setUpBeforeClass() throws Exception %7B%0A    %7D%0A%0A    @AfterClass%0A    public static void tearDownAfterClass() throws Exception %7B%0A    %7D%0A%0A    @Before%0A    public void setUp() throws Exception %7B%0A    %7D%0A%0A    @After%0A    public void tearDown() throws Exception %7B%0A    %7D
+static org.hamcrest.CoreMatchers.*;%0Aimport static org.junit.Assert.*;%0A%0Apublic class z_F4JInternalStringUtilTest %7B
 %0A%0A  
@@ -1141,16 +1141,17 @@
 %0A    %7D%0A%0A
+%0A
     @Tes
@@ -1257,16 +1257,295 @@
 tance();
+%0A        cal.set(Calendar.YEAR, 2012);%0A        cal.set(Calendar.MONTH, 5);%0A        cal.set(Calendar.DAY_OF_MONTH, 15);%0A        cal.set(Calendar.HOUR_OF_DAY, 16);%0A        cal.set(Calendar.MINUTE, 17);%0A        cal.set(Calendar.SECOND, 18);%0A        cal.set(Calendar.MILLISECOND, 0);
 %0A%0A      
@@ -1681,79 +1681,57 @@
     
-System.out.println(actual1);%0A        assertThat(actual1.length(), is(24
+assertThat(actual1, is(%222012-06-15T16:17:18+0900%22
 ));%0A
@@ -1874,91 +1874,73 @@
     
-System.out.println(actual2);%0A        assertThat(actual2.length(), is(24
+assertThat(actual2, is(%222012-06-15T07:17:18+0000%22
 ));
-%0A
     
-    
+//16-9=7%0A
 %0A   

test string util