Skip to content

Commit

Permalink
Fixed code smells in tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
tastybento committed Dec 12, 2019
1 parent a4ba9c9 commit dd6e1b4
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 9 deletions.
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
package world.bentobox.magiccobblestonegenerator;

import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.*;
import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.never;
Expand Down Expand Up @@ -94,7 +92,7 @@ public void setUp() throws Exception {
try (FileInputStream fis = new FileInputStream(path.toFile())) {

byte[] buffer = new byte[1024];
int bytesRead = 0;
int bytesRead;
JarEntry entry = new JarEntry(path.toString());
tempJarOutputStream.putNextEntry(entry);
while((bytesRead = fis.read(buffer)) != -1) {
Expand Down Expand Up @@ -151,7 +149,7 @@ public void testOnEnableDisabledPlugin() {
when(plugin.isEnabled()).thenReturn(false);
addon.onEnable();
verify(logger).severe(eq("BentoBox is not available or disabled!"));
assertTrue(addon.getState().equals(State.DISABLED));
assertEquals(addon.getState(), State.DISABLED);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,6 @@ public class SettingsTest {
private Settings s;
private YamlConfiguration config;

private String skygrid = "SkyGrid";

/**
* @throws java.lang.Exception
*/
Expand Down Expand Up @@ -92,7 +90,7 @@ public void testGetDefaultGeneratorTierMap() {
assertEquals(7, s.getDefaultGeneratorTierMap().size());
assertTrue(s.getDefaultGeneratorTierMap().containsKey("default"));
for (int i = 1; i < 7; i++) {
assertTrue(s.getDefaultGeneratorTierMap().containsKey("tier" + String.valueOf(i)));
assertTrue(s.getDefaultGeneratorTierMap().containsKey("tier" + i));
}
assertEquals("Stone Level", s.getDefaultGeneratorTierMap().get("default").getName());
}
Expand All @@ -102,6 +100,7 @@ public void testGetDefaultGeneratorTierMap() {
*/
@Test
public void testGetAddonGeneratorTierMap() {
String skygrid = "SkyGrid";
assertEquals(1, s.getAddonGeneratorTierMap(skygrid).size());
assertEquals("Diamond Level", s.getAddonGeneratorTierMap(skygrid).get("default").getName());
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package world.bentobox.magiccobblestonegenerator.listeners;

import static org.junit.Assert.*;
import static org.mockito.Mockito.when;
import static org.mockito.ArgumentMatchers.*;
import static org.mockito.Mockito.*;

Expand Down

0 comments on commit dd6e1b4

Please sign in to comment.