Skip to content

Commit 924a0fe

Browse files
Remove deprecated static methods (#30)
* Remove deprecated static methods * Update test cases --------- Co-authored-by: theEvilReaper <theEvilReaper@users.noreply.github.com>
1 parent df40d8f commit 924a0fe

4 files changed

Lines changed: 8 additions & 47 deletions

File tree

src/main/java/net/theevilreaper/aves/map/BaseMap.java

Lines changed: 0 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -46,45 +46,6 @@ public BaseMap(@NotNull String name, Pos spawn, String... builders) {
4646
this.spawn = spawn;
4747
}
4848

49-
/**
50-
* Creates a new instance from the {@link BaseMap} with all given values.
51-
* Deprecated since 1.9.0, use {@link #builder()} instead.
52-
*
53-
* @param name the name from the map
54-
*/
55-
@Deprecated(forRemoval = true, since = "1.9.0")
56-
@Contract(value = "_ -> new", pure = true)
57-
public static @NotNull BaseMap of(@NotNull String name) {
58-
return new BaseMap(name, null);
59-
}
60-
61-
/**
62-
* The constructor sets all relevant values for a map.
63-
* Deprecated since 1.9.0, use {@link #builder()} instead.
64-
*
65-
* @param name the name from the map
66-
* @param spawn the spawn location from the map
67-
*/
68-
@Deprecated(forRemoval = true, since = "1.9.0")
69-
@Contract(value = "_, _ -> new", pure = true)
70-
public static @NotNull BaseMap of(@NotNull String name, Pos spawn) {
71-
return new BaseMap(name, spawn, "team");
72-
}
73-
74-
/**
75-
* The constructor sets all relevant values for a map.
76-
* Deprecated since 1.9.0, use {@link #builder()} instead.
77-
*
78-
* @param name the name from the map
79-
* @param builders the builders from the map
80-
* @param spawn the spawn location from the map
81-
*/
82-
@Contract(value = "_, _, _ -> new", pure = true)
83-
@Deprecated(forRemoval = true, since = "1.9.0")
84-
public static @NotNull BaseMap of(@NotNull String name, Pos spawn, String... builders) {
85-
return new BaseMap(name, spawn, builders);
86-
}
87-
8849
/**
8950
* Creates a new instance of the {@link BaseMapBuilder} to build a new map.
9051
* The builder can be used to set all values that are required for a map.

src/test/java/net/theevilreaper/aves/file/FileHandlerTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ void testOtherConstructor() {
4141
@Test
4242
void testGsonFileHandlerWrite() {
4343
var path = tempDir.toPath().resolve(testMap);
44-
var baseMap = BaseMap.of("TestMap");
44+
var baseMap = new BaseMap("TestMap", null);
4545
baseMap.setBuilders("Builder1", "Builder2");
4646
fileHandler.save(path, baseMap);
4747
assertTrue(Files.exists(path));

src/test/java/net/theevilreaper/aves/file/ModernFileHandlerTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ void testOtherConstructor() {
4646
@Test
4747
void testGsonFileHandlerWrite() {
4848
var path = tempDir.toPath().resolve(testMap);
49-
var baseMap = BaseMap.of("TestMap");
49+
var baseMap = new BaseMap("TestMap", null);
5050
baseMap.setBuilders("Builder1", "Builder2");
5151
fileHandler.save(path, baseMap, TypeToken.get(BaseMap.class));
5252
assertTrue(Files.exists(path));
@@ -77,7 +77,7 @@ void testFileNotExistsRead() {
7777
@Test
7878
void testInvalidPathSave() {
7979
var path = tempDir.toPath();
80-
var baseMap = BaseMap.of("TestMap");
80+
var baseMap = new BaseMap("TestMap", null);
8181
var exception = assertThrows(
8282
IllegalArgumentException.class,
8383
() -> fileHandler.save(path, baseMap, TypeToken.get(BaseMap.class))

src/test/java/net/theevilreaper/aves/map/BaseMapTest.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,13 @@ class BaseMapTest {
1919
@BeforeAll
2020
void init() {
2121
this.builders = new String[]{"theEvilReaper, Tresson", "SeelenRetterin"};
22-
this.firstMap = BaseMap.of("Test");
23-
this.secondMap = BaseMap.of("Test", new Pos(120, 51, 23), builders[0], builders[1]);
22+
this.firstMap = new BaseMap("Test", null);
23+
this.secondMap = new BaseMap("Test", new Pos(120, 51, 23), builders[0], builders[1]);
2424
}
2525

2626
@Test
2727
void testOtherConstructor() {
28-
var baseMap = BaseMap.of("Test", Pos.ZERO);
28+
var baseMap = new BaseMap("Test", Pos.ZERO);
2929
assertSame("Test", baseMap.getName());
3030
assertSame(Pos.ZERO, baseMap.getSpawn());
3131
}
@@ -64,7 +64,7 @@ void testNameSetForMaps() {
6464

6565
@Test
6666
void testEmptyNameConstructor() {
67-
var exception = assertThrows(IllegalArgumentException.class, () -> BaseMap.of(""));
67+
var exception = assertThrows(IllegalArgumentException.class, () -> new BaseMap("", null));
6868
assertEquals("The name can not be null or empty", exception.getMessage());
6969
}
7070

@@ -94,7 +94,7 @@ void testSetSpawn() {
9494

9595
@Test
9696
void testGetSpawnOrDefault() {
97-
BaseMap baseMap = BaseMap.of("Test");
97+
BaseMap baseMap = new BaseMap("Test", null);
9898
assertNull(baseMap.getSpawn());
9999

100100
Pos defaultPos = new Pos(1, 2, 3);

0 commit comments

Comments
 (0)