Skip to content

erickzanardo/spectre

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Spectre

Rspec based test framework for Java 8

Sample test

Spectre runs every method with the Spec suffix

package org.eck.spec;

import static org.eck.spec.Spectre.describe;
import static org.eck.spec.Spectre.before;
import static org.eck.spec.Spectre.after;
import static org.eck.spec.Spectre.it;

import java.util.ArrayList;
import java.util.List;

import org.junit.Assert;
import org.junit.runner.RunWith;

@RunWith(SpectreRunner.class)
public class SampleTest {
    private List<Integer> list = new ArrayList<Integer>();

    public void listSpec() {
        describe("List", () -> {
            before(() -> {
                list.add(1);
                list.add(2);
            });

            describe("#contains", () -> {
                it("contains the value 1", () -> {
                    Assert.assertTrue(list.contains(1));
                });
                it("doesn't contains the value 3", () -> {
                    Assert.assertFalse(list.contains(3));
                });
            });

            after(() -> {
                list.clear();
            });
        });
    }
}

Avaiable blocks:

  • describe
  • context
  • it
  • before
  • beforeEach
  • after
  • afterEach

About

Rspec based test framework for Java 8

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages