Skip to content

Commit bbf34b3

Browse files
committed
[F] Fix info parser test
1 parent 4c568f1 commit bbf34b3

File tree

2 files changed

+10
-16
lines changed

2 files changed

+10
-16
lines changed

src/main/java/org/hydev/mcpm/client/arguments/parsers/InfoParser.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public void run(Namespace details, Consumer<String> log)
3535
}
3636
catch (PluginNotFoundException e)
3737
{
38-
log.accept("&cPlugin not " + name + " not found.");
38+
log.accept(String.format("&cCannot find plugin '%s'", name));
3939
}
4040
}
4141

src/test/java/org/hydev/mcpm/client/arguments/InfoParserTest.java

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,7 @@
1717
import java.util.concurrent.atomic.AtomicReference;
1818
import java.util.function.Consumer;
1919

20-
import static org.junit.jupiter.api.Assertions.assertEquals;
21-
import static org.junit.jupiter.api.Assertions.assertThrows;
20+
import static org.junit.jupiter.api.Assertions.*;
2221

2322
/**
2423
* Contains tests for testing the info controller and parser objects.
@@ -119,7 +118,7 @@ void testPluginDetailsExtended() throws ArgumentParserException {
119118
> Authors : Hello world
120119
> Commands : comm
121120
""".trim() + "\n";
122-
assertEquals(ColorLogger.trimNoColor(output.get()), expected);
121+
assertEquals(expected, ColorLogger.trimNoColor(output.get()));
123122
}
124123

125124
/**
@@ -128,17 +127,12 @@ void testPluginDetailsExtended() throws ArgumentParserException {
128127
@Test
129128
void testPluginDetailsDirectly() throws PluginNotFoundException
130129
{
131-
controller.info("My Plugin2");
132-
133-
var expected = """
134-
Plugin Info:
135-
> Name : My Plugin2
136-
> Main : org.My Plugin2
137-
> Version : v1.1
138-
> Description : bc
139-
> Authors : Hello world
140-
> Commands : comm
141-
""".trim() + "\n";
142-
assertEquals(ColorLogger.trimNoColor(output.get()), expected);
130+
var yml = controller.info("My Plugin2");
131+
assertEquals(yml.name(), "My Plugin2");
132+
assertEquals(yml.main(), "org.My Plugin2");
133+
assertEquals(yml.version(), "v1.1");
134+
assertEquals(yml.description(), "bc");
135+
assertEquals(yml.getFirstAuthor(), "Hello world");
136+
assertTrue(yml.commands().containsKey("comm"));
143137
}
144138
}

0 commit comments

Comments
 (0)