Skip to content

Commit 6db5dcf

Browse files
ThomasPerkins1123Vladimir Kotal
authored andcommitted
These tests were written using Diffblue Cover.
1 parent 3e788c1 commit 6db5dcf

File tree

1 file changed

+93
-0
lines changed

1 file changed

+93
-0
lines changed
Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
package org.opengrok.indexer.util;
2+
3+
import org.junit.Assert;
4+
import org.junit.Rule;
5+
import org.junit.Test;
6+
import org.junit.rules.ExpectedException;
7+
8+
public class BooleanUtilTest {
9+
10+
@Rule public final ExpectedException thrown = ExpectedException.none();
11+
12+
/* testedClasses: BooleanUtil */
13+
// Test written by Diffblue Cover.
14+
15+
@Test
16+
public void constructorOutputVoid() {
17+
18+
// Act, creating object to test constructor
19+
final BooleanUtil objectUnderTest = new BooleanUtil();
20+
21+
// Method returns void, testing that no exception is thrown
22+
}
23+
24+
// Test written by Diffblue Cover.
25+
@Test
26+
public void isBooleanInputNotNullOutputFalse() {
27+
28+
// Arrange
29+
final String value = "3";
30+
31+
// Act
32+
final boolean actual = BooleanUtil.isBoolean(value);
33+
34+
// Assert result
35+
Assert.assertFalse(actual);
36+
}
37+
38+
// Test written by Diffblue Cover.
39+
@Test
40+
public void isBooleanInputNotNullOutputTrue() {
41+
42+
// Arrange
43+
final String value = "1";
44+
45+
// Act
46+
final boolean actual = BooleanUtil.isBoolean(value);
47+
48+
// Assert result
49+
Assert.assertTrue(actual);
50+
}
51+
52+
// Test written by Diffblue Cover.
53+
@Test
54+
public void isBooleanInputNotNullOutputTrue2() {
55+
56+
// Arrange
57+
final String value = "faLSe";
58+
59+
// Act
60+
final boolean actual = BooleanUtil.isBoolean(value);
61+
62+
// Assert result
63+
Assert.assertTrue(actual);
64+
}
65+
66+
// Test written by Diffblue Cover.
67+
@Test
68+
public void toIntegerInputFalseOutputZero() {
69+
70+
// Arrange
71+
final boolean b = false;
72+
73+
// Act
74+
final int actual = BooleanUtil.toInteger(b);
75+
76+
// Assert result
77+
Assert.assertEquals(0, actual);
78+
}
79+
80+
// Test written by Diffblue Cover.
81+
@Test
82+
public void toIntegerInputTrueOutputPositive() {
83+
84+
// Arrange
85+
final boolean b = true;
86+
87+
// Act
88+
final int actual = BooleanUtil.toInteger(b);
89+
90+
// Assert result
91+
Assert.assertEquals(1, actual);
92+
}
93+
}

0 commit comments

Comments
 (0)