Package com.sandwich.koan

Source Code of com.sandwich.koan.KoansResultTest

package com.sandwich.koan;

import static org.junit.Assert.assertTrue;

import java.util.Arrays;

import org.junit.Test;

import com.sandwich.koan.path.CommandLineTestCase;
import com.sandwich.koan.result.KoanMethodResult;
import com.sandwich.koan.result.KoanSuiteResult;
import com.sandwich.koan.result.KoanSuiteResult.KoanResultBuilder;
import com.sandwich.koan.suite.OneFailingKoan;

public class KoansResultTest extends CommandLineTestCase {
 
  @Test
  public void testToString() throws Exception {
    KoanResultBuilder builder = new KoanResultBuilder()
      .remainingCases(Arrays.asList(OneFailingKoan.class.getSimpleName()))
      .methodResult(new KoanMethodResult(KoanMethod.getInstance("", OneFailingKoan.class.getDeclaredMethods()[0]), "msg", "2"))
      .level("1")
      .numberPassing(3);
    KoanSuiteResult result = builder.build();
    String string = result.toString();
    assertTrue(string.contains("1"));
    assertTrue(string.contains("2"));
    assertTrue(string.contains("3"));
    assertTrue(string.contains(OneFailingKoan.class.getSimpleName()));
    assertTrue(string.contains(OneFailingKoan.class.getDeclaredMethods()[0].getName()));
    assertTrue(string.contains("msg"));
  }
 
}
TOP

Related Classes of com.sandwich.koan.KoansResultTest

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.