<commit_before>/*
 * Copyright 2000-2011 JetBrains s.r.o.
 *
 * 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 jetbrains.buildServer.nuget.tests.server;

import jetbrains.buildServer.BaseTestCase;
import jetbrains.buildServer.nuget.server.exec.ListPackagesCommandProcessor;
import jetbrains.buildServer.nuget.server.exec.PackageInfo;
import org.testng.Assert;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;

import java.util.Collection;
import java.util.Iterator;

/**
 * Created by <NAME> (<EMAIL>)
 * Date: 14.07.11 14:28
 */
public class ListPackagesCommandProcessorTest extends BaseTestCase {
  private  ListPackagesCommandProcessor p;

  @BeforeMethod
  @Override
  protected void setUp() throws Exception {
    super.setUp();
    p = new ListPackagesCommandProcessor("source5");
  }

  @Test
  public void test_empty() {
    Assert.assertTrue(p.getResult().isEmpty());
  }

  @Test
  public void test_some_output() {
    for(int i =0; i <100; i++) {
      p.onStdError("asdasd");
      p.onStdOutput("3434");
    }
    Assert.assertTrue(p.getResult().isEmpty());
  }<commit_msg>add test for processor and non-zero output<commit_after>/*
 * Copyright 2000-2011 JetBrains s.r.o.
 *
 * 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 jetbrains.buildServer.nuget.tests.server;

import jetbrains.buildServer.BaseTestCase;
import jetbrains.buildServer.nuget.server.exec.ListPackagesCommandProcessor;
import jetbrains.buildServer.nuget.server.exec.PackageInfo;
import org.testng.Assert;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;

import java.util.Collection;
import java.util.Iterator;

/**
 * Created by <NAME> (<EMAIL>)
 * Date: 14.07.11 14:28
 */
public class ListPackagesCommandProcessorTest extends BaseTestCase {
  private  ListPackagesCommandProcessor p;

  @BeforeMethod
  @Override
  protected void setUp() throws Exception {
    super.setUp();
    p = new ListPackagesCommandProcessor("source5");
  }

  @Test
  public void test_empty() {
    Assert.assertTrue(p.getResult().isEmpty());
  }

  @Test
  public void test_should_throw_on_exit_code() {
    try {
      p.onFinished(1);
    } catch (RuntimeException e) {
      return;
    }
    Assert.fail("Exception expected");
  }

  @Test
  public void test_some_output() {
    for(int i =0; i <100; i++) {
      p.onStdError("asdasd");
      p.onStdOutput("3434");
    }
    Assert.assertTrue(p.getResult().isEmpty());
  }
{'fraction_non_alphanumeric': 0.10545977011494252, 'fraction_numerical': 0.01810344827586207, 'mean_word_length': 4.0376266280752535, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '6207697', 'n_tokens_mistral': 1066, 'n_tokens_neox': 1013, 'n_words': 308}