Skip to content

Commit

Permalink
Add some test for new classes
Browse files Browse the repository at this point in the history
  • Loading branch information
dmfs committed Dec 8, 2024
1 parent fb78ccc commit e2b6b7d
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package org.saynotobugs.confidence.description.bifunction;

import org.junit.jupiter.api.Test;
import org.saynotobugs.confidence.description.Text;
import org.saynotobugs.confidence.quality.composite.AllOf;
import org.saynotobugs.confidence.quality.composite.Has;
import org.saynotobugs.confidence.test.quality.DescribesAs;

import static org.saynotobugs.confidence.Assertion.assertThat;

class TextAndOriginalAndTextTest
{
@Test
void testStringCtor()
{
assertThat(new TextAndOriginalAndText<Integer>("text1", "text2"),
new AllOf<>(
new Has<>(f -> f.value(new Text("abc")), new DescribesAs("text1 abc text2")),
new Has<>(f -> f.value(678, new Text("abc")), new DescribesAs("text1 abc text2"))));
}

@Test
void testDescriptionCtor()
{
assertThat(new TextAndOriginalAndText<Integer>(new Text("text1"), new Text("text2")),
new AllOf<>(
new Has<>(f -> f.value(new Text("abc")), new DescribesAs("text1 abc text2")),
new Has<>(f -> f.value(678, new Text("abc")), new DescribesAs("text1 abc text2"))));
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package org.saynotobugs.confidence.description.bifunction;

import org.junit.jupiter.api.Test;
import org.saynotobugs.confidence.description.Text;
import org.saynotobugs.confidence.quality.composite.AllOf;
import org.saynotobugs.confidence.quality.composite.Has;
import org.saynotobugs.confidence.test.quality.DescribesAs;

import static org.saynotobugs.confidence.Assertion.assertThat;

class TextAndValueAndTextTest
{
@Test
void testStringCtor()
{
assertThat(new TextAndValueAndText<Integer>("text1", "text2"),
new AllOf<>(
new Has<>(f -> f.value(678), new DescribesAs("text1 678 text2")),
new Has<>(f -> f.value(678, new Text("irrelevant")), new DescribesAs("text1 678 text2"))));
}

@Test
void testDescriptionCtor()
{
assertThat(new TextAndValueAndText<Integer>(new Text("text1"), new Text("text2")),
new AllOf<>(
new Has<>(f -> f.value(678), new DescribesAs("text1 678 text2")),
new Has<>(f -> f.value(678, new Text("irrelevant")), new DescribesAs("text1 678 text2"))));
}
}

0 comments on commit e2b6b7d

Please sign in to comment.