package de.vksi.c4j.acceptancetest.s5a;
import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertThat;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
import de.vksi.c4j.systemtest.TransformerAwareRule;
import de.vksi.c4j.acceptancetest.subinterfaces.VeryBottom;
public class NNClassInvariantS5aTest {
@Rule
public TransformerAwareRule transformerAware = new TransformerAwareRule();
@Rule
public ExpectedException thrown = ExpectedException.none();
@Test
public void returnsValueWhenClassInvariantIsSatisfied() {
assertThat(new VeryBottom(2).invariant(""), is(2));
}
@Test
public void failsWhenClassInvariantConditionIsNotMet() {
thrown.expect(AssertionError.class);
thrown.expectMessage("multiple of two");
new VeryBottom(3).invariant("");
}
}