Skip to content

Commit

Permalink
Add equals and toString tests for new classes
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidGregory084 committed May 22, 2024
1 parent 65a5d13 commit ba3a902
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/test/java/com/opencastsoftware/prettier4j/DocTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -841,7 +841,7 @@ void testEquals() {
.findFirst().get();

// EqualsVerifier doesn't work with singletons,
// so we can't test Line, LineOrSpace, LineOrEmpty or Empty:
// so we can't test Reset, Line, LineOrSpace, LineOrEmpty or Empty:
// it requires prefab values for recursive data types and
// those prefab values must not be equal to each other
EqualsVerifier
Expand Down
24 changes: 24 additions & 0 deletions src/test/java/com/opencastsoftware/prettier4j/ansi/ColorTest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/*
* SPDX-FileCopyrightText: © 2024 Opencast Software Europe Ltd <https://opencastsoftware.com>
* SPDX-License-Identifier: Apache-2.0
*/
package com.opencastsoftware.prettier4j.ansi;

import com.jparams.verifier.tostring.ToStringVerifier;
import nl.jqno.equalsverifier.EqualsVerifier;
import org.junit.jupiter.api.Test;

public class ColorTest {
@Test
void testEquals() {
EqualsVerifier.forClasses(
Color.class, Color16.class,
Color256.class, ColorRgb.class)
.usingGetClass().verify();
}

@Test
void testToString() {
ToStringVerifier.forClasses(Color16.class, Color256.class, ColorRgb.class).verify();
}
}
23 changes: 23 additions & 0 deletions src/test/java/com/opencastsoftware/prettier4j/ansi/StylesTest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package com.opencastsoftware.prettier4j.ansi;

import com.jparams.verifier.tostring.ToStringVerifier;
import nl.jqno.equalsverifier.EqualsVerifier;
import org.junit.jupiter.api.Test;

public class StylesTest {
@Test
void testEquals() {
EqualsVerifier.forClasses(Styles.Fg.class, Styles.Bg.class)
.usingGetClass()
.verify();
}

@Test
void testToString() {
ToStringVerifier.forClasses(
Styles.Fg.class, Styles.Bg.class, Styles.Bold.class,
Styles.Faint.class, Styles.Italic.class, Styles.Underline.class,
Styles.Blink.class, Styles.Inverse.class, Styles.Strikethrough.class)
.withIgnoredFields("shiftValue").verify();
}
}

0 comments on commit ba3a902

Please sign in to comment.