Skip to content

Commit

Permalink
add more tests
Browse files Browse the repository at this point in the history
  • Loading branch information
dmfs committed Dec 8, 2024
1 parent e2b6b7d commit e615ae0
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,17 @@

class PassTest
{
@Test
void testDefaultCtor()
{
assertThat(new Pass(),
new AllOf<>(
new Satisfies<>(Assessment::isSuccess, new Text("passes")),
new Has<>(Assessment::description, new DescribesAs(""))
));
}


@Test
void test()
{
Expand All @@ -21,5 +32,4 @@ void test()
new Has<>(Assessment::description, new DescribesAs("pass"))
));
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,39 @@

class PassedTest
{
@Test
void testWithString()
{
assertThat(new Passed("abc"),
new AllOf<>(
new Passes<>(new Pass(new Text("abc")), "both,\n" +
" passes and\n" +
" had description described as\n" +
" ----\n" +
" \"abc\"\n" +
" ----"),
new Fails<Assessment>(new Assessment()
{
@Override
public boolean isSuccess()
{
return true;
}


@Override
public org.saynotobugs.confidence.Description description()
{
return new Text("oops");
}
}, "both,\n ... and\n had description described as\n ----\n \"oops\"\n ----"),
new Fails<>(new Fail(new Text("failed")), "both,\n failed and\n had description described as\n ----\n \"failed\"\n ----"),
new HasDescription("both,\n passes and\n has description describes as\n ----\n \"abc\"\n ----")
));
}

@Test
void test()
void testWithQuality()
{
assertThat(new Passed(new DescribesAs("abc")),
new AllOf<>(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,22 @@ public org.saynotobugs.confidence.Description description()
" ----\n" +
" ----"),
new Fails<>(new Quality<Integer>()
{
@Override
public Assessment assessmentOf(Integer candidate)
{
return new Pass(new Text("incorrect"));
}


@Override
public org.saynotobugs.confidence.Description description()
{
return new Text("passes");
}
},
"passed 1 with description \n ----\n incorrect\n ----"),
new Fails<>(new Quality<Integer>()
{
@Override
public Assessment assessmentOf(Integer candidate)
Expand Down

0 comments on commit e615ae0

Please sign in to comment.