JUnit Assert that - Java Testing

Java examples for Testing:JUnit

Description

JUnit Assert that

Demo Code


import org.junit.Test;

import static org.hamcrest.core.Is.is;
import static org.junit.Assert.assertThat;

public class BlogMainTest {

  private final String[] BLOG_ENTRIES = {"First Note", "Another Note", "End"};

  private BlogMain tested = new BlogMain();

  @Test//  w  w  w  .j av  a  2 s .co m
  public void addNoteTest() throws Exception {
    for (String entry : BLOG_ENTRIES) {
      assertThat(tested.addNote(entry).contains("Note"),is(true));
    }
  }

}

Related Tutorials