2 * Sone - VersionCommandTest.java - Copyright © 2013 David Roden
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 3 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 package net.pterodactylus.sone.fcp;
20 import static net.pterodactylus.sone.Verifiers.verifyAnswer;
21 import static net.pterodactylus.sone.freenet.fcp.Command.AccessType.DIRECT;
22 import static net.pterodactylus.sone.main.SonePlugin.VERSION;
23 import static org.hamcrest.MatcherAssert.assertThat;
24 import static org.hamcrest.Matchers.is;
26 import net.pterodactylus.sone.data.Mocks;
27 import net.pterodactylus.sone.freenet.SimpleFieldSetBuilder;
28 import net.pterodactylus.sone.freenet.fcp.Command.Response;
30 import freenet.support.SimpleFieldSet;
32 import org.junit.Test;
35 * Unit test for {@link VersionCommand}.
37 * @author <a href="mailto:bombe@pterodactylus.net">David ‘Bombe’ Roden</a>
39 public class VersionCommandTest {
41 private final Mocks mocks = new Mocks();
42 private final VersionCommand versionCommand = new VersionCommand(mocks.core);
45 public void theCorrectVersionNumberIsReturned() {
46 SimpleFieldSet versionFieldSet = new SimpleFieldSetBuilder().put("Message", "Version").get();
47 Response response = versionCommand.execute(versionFieldSet, null, DIRECT);
48 verifyAnswer(response, "Version");
49 assertThat(response.getReplyParameters().get("Version"), is(VERSION.toString()));