<commit_before>package facebook4j.json;

/**
 * Created with IntelliJ IDEA.
 * User: ryu
 * Date: 2013/05/18
 * Time: 0:13
 * To change this template use File | Settings | File Templates.
 */
public class DataObjectFactoryTest {
}<commit_msg>Test DataObjectFactory<commit_after>/*
 * Copyright 2012 <NAME>
 *
 * 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.json;

import facebook4j.FacebookFactory;
import facebook4j.FacebookTestBase;
import facebook4j.Post;
import facebook4j.ResponseList;
import facebook4j.auth.AccessToken;
import facebook4j.auth.OAuthAuthorization;
import facebook4j.conf.Configuration;
import facebook4j.conf.ConfigurationBuilder;
import org.hamcrest.CoreMatchers;
import org.junit.*;

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

public class DataObjectFactoryTest extends FacebookTestBase {
    @BeforeClass
    public static void setUpBeforeClass() throws Exception {
    }

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

    @Before
    public void setUp() throws Exception {
        Configuration conf = new ConfigurationBuilder().setOAuthAppId(appId).setOAuthAppSecret(appSecret)
                                                       .setJSONStoreEnabled(true)
                                                       .build();
        facebook1 = new FacebookFactory().getInstance(new OAuthAuthorization(conf));
        facebook1.setOAuthAccessToken(new AccessToken(id1.getAccessToken(), null));
    }

    @After
    public void tearDown() throws Exception {
    }

    @Test
    public void getRawJSON() throws Exception {
        ResponseList<Post> posts = facebook1.getPosts();
        String rawJSON = DataObjectFactory.getRawJSON(posts);
        assertThat(rawJSON, is(notNullValue()));
        System.out.println(rawJSON);
    }

}
{'fraction_non_alphanumeric': 0.0839662447257384, 'fraction_numerical': 0.013924050632911392, 'mean_word_length': 3.310909090909091, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 1, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 8, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4334499', 'n_tokens_mistral': 642, 'n_tokens_neox': 609, 'n_words': 194}