Skip to content

Commit

Permalink
Code Check 2 23 223
Browse files Browse the repository at this point in the history
  • Loading branch information
sathishk committed Mar 2, 2024
1 parent 76dfb4e commit 4d04c82
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/main/java/com/techatpark/sjson/core/Json.java
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ public static final class ContentExtractor {
*
* @param theReader
*/
private ContentExtractor(final Reader theReader) {
public ContentExtractor(final Reader theReader) {
this.reader = theReader;
}

Expand Down
27 changes: 27 additions & 0 deletions src/test/java/com/techatpark/sjson/core/NumberParserTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
import java.util.List;
import java.util.Set;

import static com.techatpark.sjson.core.util.ReaderUtil.nextClean;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertThrows;

class NumberParserTest {
Expand Down Expand Up @@ -78,6 +80,31 @@ private static List<Number> numbers() {
);
}

/**
* Tests Where Reader completes cursor.
* <p>
* Steps:
* 1) Pass valid number value(validjson) (With following 1.
* 2) Read java object using JSON.
* </p>
* Expected Result:
* next Clean Should be at 1
*
* @param validjson
*/
@ParameterizedTest
@ValueSource(strings = {
"2,1",
"2.5,1"
})
void testCursor(final String validjson) throws IOException {
StringReader reader = new StringReader(validjson);
char firstChar = nextClean(reader); // Move to First Digit
NumberParser.getNumber(new Json.ContentExtractor(reader),reader, firstChar);
assertEquals('1',
nextClean(reader));
}



}

0 comments on commit 4d04c82

Please sign in to comment.