Skip to content

Commit

Permalink
Account for boxed classes - 2.6.1
Browse files Browse the repository at this point in the history
  • Loading branch information
virustotalop committed Feb 7, 2023
1 parent e46b55c commit f34babb
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 4 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ repositories {
maven { url 'https://jitpack.io' }
}
compile 'com.github.clubobsidian:wrappy:2.6.0'
compile 'com.github.clubobsidian:wrappy:2.6.1'
```

### Maven
Expand All @@ -43,7 +43,7 @@ compile 'com.github.clubobsidian:wrappy:2.6.0'
<dependency>
<groupId>com.github.clubobsidian</groupId>
<artifactId>wrappy</artifactId>
<version>2.6.0</version>
<version>2.6.1</version>
</dependency>
```

Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ dependencies {
shadowJar {
baseName = 'wrappy'
classifier = null
version = '2.6.0'
version = '2.6.1'
}

artifacts {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,15 @@ public class ConfigurationSection {

private static final Map<Class<?>, Object> DEFAULT_VALUES = new HashMap() {{
put(int.class, 0);
put(Integer.class, 0);
put(long.class, 0l);
put(float.class, 0f);
put(Long.class, 0l);
put(float.class, 0.0f);
put(Float.class, 0.0f);
put(boolean.class, false);
put(Boolean.class, false);
put(double.class, 0.0);
put(Double.class, 0.0);
}};

protected ConfigurationNode node;
Expand Down
42 changes: 42 additions & 0 deletions src/test/java/com/clubobsidian/wrappy/test/config/TestDefault.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
/*
* Copyright 2021 Club Obsidian and contributors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.clubobsidian.wrappy.test.config;

import com.clubobsidian.wrappy.Configuration;
import org.junit.Test;

import java.io.File;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;

public class TestDefault {

private static File testFile = new File("test.yml");
private static Configuration config = Configuration.load(testFile);

@Test
public void testNodeNotNull() {
assertTrue("Configurate node was null", config.getNode() != null);
}

@Test
public void testFloat() {
assertEquals(0.0f, config.getFloat("does-not-exist"), 0.01);
}

}

0 comments on commit f34babb

Please sign in to comment.