11package com .thealgorithms .bitmanipulation ;
22
3+ import static org .junit .jupiter .api .Assertions .assertDoesNotThrow ;
34import static org .junit .jupiter .api .Assertions .assertEquals ;
45import static org .junit .jupiter .api .Assertions .assertThrows ;
56import static org .junit .jupiter .api .Assertions .assertTrue ;
6- import static org . junit . jupiter . api . Assertions . assertDoesNotThrow ;
7+
78import org .junit .jupiter .api .Test ;
89
910/**
@@ -151,16 +152,14 @@ public void testRotateAllZeros() {
151152 @ Test
152153 public void testRotateLeftNegativeShift () {
153154 // Negative shifts should throw IllegalArgumentException
154- Exception exception = assertThrows (IllegalArgumentException .class ,
155- () -> BitRotate .rotateLeft (42 , -1 ));
155+ Exception exception = assertThrows (IllegalArgumentException .class , () -> BitRotate .rotateLeft (42 , -1 ));
156156 assertTrue (exception .getMessage ().contains ("negative" ));
157157 }
158158
159159 @ Test
160160 public void testRotateRightNegativeShift () {
161161 // Negative shifts should throw IllegalArgumentException
162- Exception exception = assertThrows (IllegalArgumentException .class ,
163- () -> BitRotate .rotateRight (42 , -5 ));
162+ Exception exception = assertThrows (IllegalArgumentException .class , () -> BitRotate .rotateRight (42 , -5 ));
164163 assertTrue (exception .getMessage ().contains ("negative" ));
165164 }
166165
@@ -171,10 +170,10 @@ public void testRotateLeftRightComposition() {
171170 // Rotating left then right by same amount should return original value
172171 int original = 0x12345678 ;
173172 int shift = 7 ;
174-
173+
175174 int leftRotated = BitRotate .rotateLeft (original , shift );
176175 int restored = BitRotate .rotateRight (leftRotated , shift );
177-
176+
178177 assertEquals (original , restored );
179178 }
180179
@@ -183,10 +182,10 @@ public void testRotateRightLeftComposition() {
183182 // Rotating right then left by same amount should return original value
184183 int original = 0x9ABCDEF0 ;
185184 int shift = 13 ;
186-
185+
187186 int rightRotated = BitRotate .rotateRight (original , shift );
188187 int restored = BitRotate .rotateLeft (rightRotated , shift );
189-
188+
190189 assertEquals (original , restored );
191190 }
192191
@@ -203,4 +202,4 @@ public void testTraversals() {
203202 assertDoesNotThrow (() -> BitRotate .rotateLeft (1 , 1 ));
204203 assertDoesNotThrow (() -> BitRotate .rotateRight (1 , 1 ));
205204 }
206- }
205+ }
0 commit comments