1   /*
2    *  XNap
3    *
4    *  A pure java file sharing client.
5    *
6    *  See AUTHORS for copyright information.
7    *
8    *  This program is free software; you can redistribute it and/or modify
9    *  it under the terms of the GNU General Public License as published by
10   *  the Free Software Foundation; either version 2 of the License, or
11   *  (at your option) any later version.
12   *
13   *  This program is distributed in the hope that it will be useful,
14   *  but WITHOUT ANY WARRANTY; without even the implied warranty of
15   *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16   *  GNU General Public License for more details.
17   *
18   *  You should have received a copy of the GNU General Public License
19   *  along with this program; if not, write to the Free Software
20   *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
21   *
22   */
23  package org.xnap.plugin.opennap.util;
24  
25  import junit.framework.TestCase;
26  
27  /***
28   * @author Steffen Pingel
29   */
30  public class OpenNapServerVersionTest extends TestCase {
31      
32      private OpenNapServerVersion version_0_45 = new OpenNapServerVersion("0.45");
33      private OpenNapServerVersion version_0_0_45
34  		= new OpenNapServerVersion("0.0.45");
35      private OpenNapServerVersion version_foo = new OpenNapServerVersion("foo");
36  
37      public OpenNapServerVersionTest(String name) 
38      {
39  		super(name);
40      }
41  
42      protected void setUp()
43      {
44      }
45  
46      public void testFallback()
47      {
48  		OpenNapServerVersion v = new OpenNapServerVersion("foo");
49  		assertEquals(v.getNextVersion(), OpenNapServerVersion.OPENNAP044);
50      }
51  
52      public void testRecognize()
53      {
54  		OpenNapServerVersion v = new OpenNapServerVersion("opennap 0.45");
55  		assertEquals(v.getNextVersion(), OpenNapServerVersion.OPENNAP044);
56  		assertTrue(v.isCompatibleTo(OpenNapServerVersion.OPENNAP044));
57  
58  		assertTrue(OpenNapServerVersion.OPENNAP044.isCompatibleTo
59  						  (OpenNapServerVersion.OPENNAP044));
60      }
61  
62      public void testSlavanap()
63      {
64  		OpenNapServerVersion v = new OpenNapServerVersion("SlavaNap 2.1.1");
65  		assertEquals(v.getNextVersion(), OpenNapServerVersion.SLAVANAP2);
66      }
67  
68  }