<commit_before>package com.infinitemule.espn.api.test.now.spring;

import static com.infinitemule.espn.common.lang.Console.printfn;
import static com.infinitemule.espn.common.lang.Console.println;

import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;


import com.infinitemule.espn.api.now.Feed;
import com.infinitemule.espn.api.now.NowApiRequest;
import com.infinitemule.espn.api.now.NowApiResponse;
import com.infinitemule.espn.api.now.NowApiService;
import com.infinitemule.espn.api.now.NowLeague;
import com.infinitemule.espn.api.test.AbstractApiServiceSpringIntgTest;
import com.infinitemule.espn.common.api.Image;
import com.infinitemule.espn.common.api.NewsCategory;
import com.infinitemule.espn.common.api.Teams;
import com.infinitemule.espn.common.api.Video;

public class NowApiServiceSpringIntgTest extends AbstractApiServiceSpringIntgTest {

  @Autowired
  private NowApiService srv = null;
  
  @Test
  public void latest() {
    
    NowApiRequest request = new NowApiRequest()
      .now();

      output(srv.call(request));
    
  }

  @Test
  public void top() {
    
    NowApiRequest request = new NowApiRequest()
      .top();

    output(srv.call(request));
    
  }
  

  @Test
  public void popular() {
    
    NowApiRequest request = new NowApiRequest()
      .popular();

    output(srv.call(request));
    
  }

  @Test
  public void limit() {
    
    NowApiRequest request = new NowApiRequest()
      .top()
      .limit(5);
        
    output(srv.call(request));
    
  }

  @Test
  public void nowLeague() {
    
    NowApiRequest request = new NowApiRequest()
      .now()
      .league(NowLeague.NFL);
        
    output(srv.call(request));
  }
  

  @Test
  public void nowLeagueTeam() {
    
    NowApiRequest request = new NowApiRequest()
      .now()
      .league(NowLeague.MLB)
      .teams(Teams.MLB.BOS);
        
    output(srv.call(request));
  }
  

  
  private void output(NowApiResponse resp) {
    
    for(Feed breaking : resp.getBreakingNews()) {
      println("********** BREAKING NEWS **********");
      printfn("%s (%s)", breaking.getHeadline(), breaking.getId());
      println("  - Description:");
      printfn("      %s - %s - %s", breaking.getPublished(), breaking.getType(), breaking.getSection());
      printfn("      %s", breaking.getDescription());      
      println();
      println();
    }
    
    
    for(Feed feed : resp.getFeed()) {
      println("----------------------------------------");
      printfn("%s (%s)", feed.getHeadline(), feed.getId());
      <commit_msg>Added test for language for Now API.<commit_after>package com.infinitemule.espn.api.test.now.spring;

import static com.infinitemule.espn.common.lang.Console.printfn;
import static com.infinitemule.espn.common.lang.Console.println;

import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;


import com.infinitemule.espn.api.now.Feed;
import com.infinitemule.espn.api.now.NowApiRequest;
import com.infinitemule.espn.api.now.NowApiResponse;
import com.infinitemule.espn.api.now.NowApiService;
import com.infinitemule.espn.api.now.NowLeague;
import com.infinitemule.espn.api.test.AbstractApiServiceSpringIntgTest;
import com.infinitemule.espn.common.api.Image;
import com.infinitemule.espn.common.api.Language;
import com.infinitemule.espn.common.api.NewsCategory;
import com.infinitemule.espn.common.api.Teams;
import com.infinitemule.espn.common.api.Video;

public class NowApiServiceSpringIntgTest extends AbstractApiServiceSpringIntgTest {

  @Autowired
  private NowApiService srv = null;
  
  @Test
  public void latest() {
    
    NowApiRequest request = new NowApiRequest()
      .now();

      output(srv.call(request));
    
  }

  @Test
  public void top() {
    
    NowApiRequest request = new NowApiRequest()
      .top();

    output(srv.call(request));
    
  }
  

  @Test
  public void popular() {
    
    NowApiRequest request = new NowApiRequest()
      .popular();

    output(srv.call(request));
    
  }

  @Test
  public void limit() {
    
    NowApiRequest request = new NowApiRequest()
      .top()
      .limit(5);
        
    output(srv.call(request));
    
  }

  @Test
  public void nowLeague() {
    
    NowApiRequest request = new NowApiRequest()
      .now()
      .league(NowLeague.NFL);
        
    output(srv.call(request));
  }
  

  @Test
  public void nowLeagueTeam() {
    
    NowApiRequest request = new NowApiRequest()
      .now()
      .league(NowLeague.MLB)
      .teams(Teams.MLB.BOS);
        
    output(srv.call(request));
  }
  
  
  @Test
  public void nowLanguage() {
    
    NowApiRequest request = new NowApiRequest()
      .now()      
      .language(Language.Spanish);
        
    output(srv.call(request));
  }
  

  
  private void output(NowApiResponse resp) {
    
    for(Feed breaking : resp.getBreakingNews()) {
      println("********** BREAKING NEWS **********");
      printfn("%s (%s)", breaking.getHeadline(), breaking.getId());
      println("  - Description:");
      printfn("      %s - %s - %s", breaking.getPublished(), breaking.getType(), breaking.getSection());
      printfn("      %s", breaking.getDescription());      
      println();
      println();
    }
    
    
    for(Feed feed : resp.getFeed()) {
      println("----------------------------------------");
      printfn("%s (%s)", feed.getHeadline(), feed.getId());
      
{'fraction_non_alphanumeric': 0.1483597493549576, 'fraction_numerical': 0.00036859565057132326, 'mean_word_length': 2.7401791867677465, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7155075', 'n_tokens_mistral': 1799, 'n_tokens_neox': 1759, 'n_words': 303}