Skip to content

Commit

Permalink
Fixes issue #41 - Fix code smells (#42)
Browse files Browse the repository at this point in the history
  • Loading branch information
mnriem authored Mar 22, 2023
1 parent ec51eb6 commit 969c7e0
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 12 deletions.
14 changes: 6 additions & 8 deletions src/test/java/com/manorrock/parakeet/YAMLReaderTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ void testReadObjectUsingAHashMap3() throws Exception {
* @throws Exception when a serious error occurs.
*/
@Test
public void testReadObjectUsingAMapWithString() throws Exception {
void testReadObjectUsingAMapWithString() throws Exception {
YAMLReader reader = new YAMLReader(new StringReader("map: 'a string' "));
Map<String, Object> map = (Map<String, Object>) reader.readObject(HashMap.class.getName());
assertTrue(map.containsKey("map"));
Expand All @@ -101,7 +101,7 @@ public void testReadObjectUsingAMapWithString() throws Exception {
* @throws Exception when a serious error occurs.
*/
@Test
public void testReadObjectUsingAString() throws Exception {
void testReadObjectUsingAString() throws Exception {
YAMLReader reader = new YAMLReader(new StringReader(" 'a string' "));
String string = (String) reader.readObject(String.class.getName());
assertEquals("a string", string);
Expand All @@ -113,7 +113,7 @@ public void testReadObjectUsingAString() throws Exception {
* @throws Exception when a serious error occurs.
*/
@Test
public void testReadObjectUsingABoolean() throws Exception {
void testReadObjectUsingABoolean() throws Exception {
YAMLReader reader = new YAMLReader(new StringReader("true"));
Boolean booleanValue = (Boolean) reader.readObject(Boolean.class.getName());
assertTrue(booleanValue);
Expand All @@ -125,7 +125,7 @@ public void testReadObjectUsingABoolean() throws Exception {
* @throws Exception when a serious error occurs.
*/
@Test
public void testReadObjectUsingAMapWithAnInteger() throws Exception {
void testReadObjectUsingAMapWithAnInteger() throws Exception {
YAMLReader reader = new YAMLReader(new StringReader("map: 12345"));
Map<String, Object> map = (Map<String, Object>) reader.readObject(HashMap.class.getName());
assertTrue(map.containsKey("map"));
Expand All @@ -138,22 +138,20 @@ public void testReadObjectUsingAMapWithAnInteger() throws Exception {
* @throws Exception when a serious error occurs.
*/
@Test
public void testReadObjectUsingAMapWithAFloat() throws Exception {
void testReadObjectUsingAMapWithAFloat() throws Exception {
YAMLReader reader = new YAMLReader(new StringReader("map: 12.345"));
Map<String, Object> map = (Map<String, Object>) reader.readObject(HashMap.class.getName());
assertTrue(map.containsKey("map"));
assertEquals(12.345d, map.get("map"));
}



/**
* Test readObject method.
*
* @throws Exception when a serious error occurs.
*/
@Test
public void testReadObjectUsingAList() throws Exception {
void testReadObjectUsingAList() throws Exception {
YAMLReader reader = new YAMLReader(new StringReader(""));
Collection collection = (Collection) reader.readObject(ArrayList.class.getName());
assertTrue(collection instanceof ArrayList);
Expand Down
8 changes: 4 additions & 4 deletions src/test/java/com/manorrock/parakeet/YAMLWriterTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,15 @@
*
* @author Manfred Riem ([email protected])
*/
public class YAMLWriterTest {
class YAMLWriterTest {

/**
* Test writeObject method.
*
* @throws Exception when a serious error occurs.
*/
@Test
public void testWriteObjectUsingAMap() throws Exception {
void testWriteObjectUsingAMap() throws Exception {
HashMap<String, Object> map = new HashMap<>();
map.put("stringValue", "this is a string");
StringWriter stringWriter = new StringWriter();
Expand All @@ -64,7 +64,7 @@ public void testWriteObjectUsingAMap() throws Exception {
* @throws Exception when a serious error occurs.
*/
@Test
public void testWriteObjectUsingAMap2() throws Exception {
void testWriteObjectUsingAMap2() throws Exception {
HashMap<String, Object> map = new HashMap<>();
map.put("integerValue", 1);
StringWriter stringWriter = new StringWriter();
Expand All @@ -79,7 +79,7 @@ public void testWriteObjectUsingAMap2() throws Exception {
* @throws Exception when a serious error occurs.
*/
@Test
public void testWriteObjectUsingAMap3() throws Exception {
void testWriteObjectUsingAMap3() throws Exception {
HashMap<String, Object> map = new HashMap<>();
map.put("booleanValue", true);
StringWriter stringWriter = new StringWriter();
Expand Down

0 comments on commit 969c7e0

Please sign in to comment.