cooking plugin: fix wine fermentation timer to begin at appropriate time

Co-authored-by: Adam <Adam@sigterm.info>
This commit is contained in:
Austin Bryant
2019-05-23 00:56:25 -04:00
committed by Adam
parent edf3abb75b
commit acaef50b91
2 changed files with 33 additions and 38 deletions

View File

@@ -29,12 +29,11 @@ import com.google.inject.testing.fieldbinder.Bind;
import com.google.inject.testing.fieldbinder.BoundFieldModule;
import javax.inject.Inject;
import net.runelite.api.ChatMessageType;
import net.runelite.api.Client;
import net.runelite.api.events.ChatMessage;
import net.runelite.client.ui.overlay.OverlayManager;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.mockito.Mockito.when;
import org.junit.Before;
import org.junit.Test;
@@ -52,13 +51,16 @@ public class CookingPluginTest
"You cook the karambwan. It looks delicious.",
"You roast a lobster.",
"You cook a bass.",
"You squeeze the grapes into the jug. The wine begins to ferment.",
"You successfully bake a tasty garden pie."
};
@Inject
CookingPlugin cookingPlugin;
@Mock
@Bind
Client client;
@Mock
@Bind
CookingConfig config;
@@ -94,26 +96,4 @@ public class CookingPluginTest
assertNotNull(cookingSession);
assertEquals(COOKING_MESSAGES.length, cookingSession.getCookAmount());
}
@Test
public void testFermentTimerOnChatMessage()
{
when(config.fermentTimer()).thenReturn(true);
ChatMessage chatMessage = new ChatMessage(null, ChatMessageType.SPAM, "", COOKING_MESSAGES[6], "", 0);
cookingPlugin.onChatMessage(chatMessage);
FermentTimerSession fermentTimerSession = cookingPlugin.getFermentTimerSession();
assertNotNull(fermentTimerSession);
}
@Test
public void testFermentTimerOnChatMessage_pluginDisabled()
{
when(config.fermentTimer()).thenReturn(false);
ChatMessage chatMessage = new ChatMessage(null, ChatMessageType.SPAM, "", COOKING_MESSAGES[6], "", 0);
cookingPlugin.onChatMessage(chatMessage);
FermentTimerSession fermentTimerSession = cookingPlugin.getFermentTimerSession();
assertNull(fermentTimerSession);
}
}