Skip to content

Commit

Permalink
change: rename PropertiesFileConfiguration to PropertiesConfiguration
Browse files Browse the repository at this point in the history
  • Loading branch information
Siroshun09 committed Jul 3, 2021
1 parent a9cc865 commit 2abc48f
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,32 +32,32 @@
/**
* A implementation class that gets value from {@link Properties}.
*/
public class PropertiesFileConfiguration extends AbstractFileConfiguration {
public class PropertiesConfiguration extends AbstractFileConfiguration {

/**
* Creates a new {@link PropertiesFileConfiguration}.
* Creates a new {@link PropertiesConfiguration}.
*
* @param path the filepath to load
* @return the new {@link PropertiesFileConfiguration}
* @return the new {@link PropertiesConfiguration}
*/
public static @NotNull PropertiesFileConfiguration create(@NotNull Path path) {
public static @NotNull PropertiesConfiguration create(@NotNull Path path) {
return create(path, new Properties());
}

/**
* Creates a new {@link PropertiesFileConfiguration}.
* Creates a new {@link PropertiesConfiguration}.
*
* @param path the filepath to load
* @param properties the {@link Properties}
* @return the new {@link PropertiesFileConfiguration}
* @return the new {@link PropertiesConfiguration}
*/
public static @NotNull PropertiesFileConfiguration create(@NotNull Path path, @NotNull Properties properties) {
return new PropertiesFileConfiguration(path, properties);
public static @NotNull PropertiesConfiguration create(@NotNull Path path, @NotNull Properties properties) {
return new PropertiesConfiguration(path, properties);
}

private final Properties properties;

private PropertiesFileConfiguration(@NotNull Path path, @NotNull Properties properties) {
private PropertiesConfiguration(@NotNull Path path, @NotNull Properties properties) {
super(path);
this.properties = properties;
}
Expand Down Expand Up @@ -138,7 +138,7 @@ public void save(@Nullable String comments) throws IOException {
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
PropertiesFileConfiguration that = (PropertiesFileConfiguration) o;
PropertiesConfiguration that = (PropertiesConfiguration) o;
return properties.equals(that.properties);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

package com.github.siroshun09.configapi.api.test.file;

import com.github.siroshun09.configapi.api.file.PropertiesFileConfiguration;
import com.github.siroshun09.configapi.api.file.PropertiesConfiguration;
import com.github.siroshun09.configapi.api.util.ResourceUtils;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
Expand All @@ -25,20 +25,20 @@
import java.nio.file.Files;
import java.nio.file.Path;

class PropertiesFileConfigurationTest {
class PropertiesConfigurationTest {

private static final Path PROPERTIES_PATH = Path.of("test.properties");

@Test
void testSaving() throws IOException {
var config = PropertiesFileConfiguration.create(PROPERTIES_PATH);
var config = PropertiesConfiguration.create(PROPERTIES_PATH);

config.set("aaa.bbb.ccc", "value");
config.set("example.key", 1);

config.save();

var sameConfig = PropertiesFileConfiguration.create(PROPERTIES_PATH);
var sameConfig = PropertiesConfiguration.create(PROPERTIES_PATH);
sameConfig.load();

Assertions.assertEquals(config, sameConfig);
Expand All @@ -56,7 +56,7 @@ void testLoading() throws IOException {
getClass().getClassLoader(), "example.properties", PROPERTIES_PATH
);

var config = PropertiesFileConfiguration.create(PROPERTIES_PATH);
var config = PropertiesConfiguration.create(PROPERTIES_PATH);

config.load();

Expand Down

0 comments on commit 2abc48f

Please sign in to comment.