Changeset 0f75748 for core


Ignore:
Timestamp:
Dec 2, 2017 6:22:59 PM (3 years ago)
Author:
str4d <str4d@…>
Branches:
master
Children:
a574fcb
Parents:
b8eeb72
Message:

Migrate DummyNamingServiceTest? to JUnit 4, comment out tests requiring a router

File:
1 edited

Legend:

Unmodified
Added
Removed
  • core/java/test/junit/net/i2p/client/naming/DummyNamingServiceTest.java

    rb8eeb72 r0f75748  
    11package net.i2p.client.naming;
    22
     3import static org.junit.Assert.*;
    34
    4 import junit.framework.TestCase;
     5import org.junit.Before;
     6import org.junit.Test;
    57
    68import net.i2p.I2PAppContext;
     
    810
    911
    10 public class DummyNamingServiceTest extends TestCase {
     12public class DummyNamingServiceTest {
     13    // The good b64 and b32 are the destination of www.i2p-projekt.i2p =)
     14    private static String goodB64 = "8ZAW~KzGFMUEj0pdchy6GQOOZbuzbqpWtiApEj8LHy2~O~58XKxRrA43cA23a9oDpNZDqWhRWEtehSnX5NoCwJcXWWdO1ksKEUim6cQLP-VpQyuZTIIqwSADwgoe6ikxZG0NGvy5FijgxF4EW9zg39nhUNKRejYNHhOBZKIX38qYyXoB8XCVJybKg89aMMPsCT884F0CLBKbHeYhpYGmhE4YW~aV21c5pebivvxeJPWuTBAOmYxAIgJE3fFU-fucQn9YyGUFa8F3t-0Vco-9qVNSEWfgrdXOdKT6orr3sfssiKo3ybRWdTpxycZ6wB4qHWgTSU5A-gOA3ACTCMZBsASN3W5cz6GRZCspQ0HNu~R~nJ8V06Mmw~iVYOu5lDvipmG6-dJky6XRxCedczxMM1GWFoieQ8Ysfuxq-j8keEtaYmyUQme6TcviCEvQsxyVirr~dTC-F8aZ~y2AlG5IJz5KD02nO6TRkI2fgjHhv9OZ9nskh-I2jxAzFP6Is1kyAAAA";
     15    private static String goodB32 = "udhdrtrcetjm5sxzskjyr5ztpeszydbh4dpl3pl4utgqqw2v4jna.b32.i2p";
     16
     17    // TODO: Come up with an actual bad b64 and b32
     18    private static String badB64 = "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA";
     19    private static String badB32 = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.b32.i2p";
     20
    1121    private I2PAppContext _context;
    1222
     23    @Before
    1324    public void setUp() throws Exception {
    1425        _context = new I2PAppContext();
    1526    }
    1627
    17     public void testLookup() throws Exception{
    18         // The good b64 and b32 are the destination of www.i2p-projekt.i2p =)
    19         String goodB64 = "8ZAW~KzGFMUEj0pdchy6GQOOZbuzbqpWtiApEj8LHy2~O~58XKxRrA43cA23a9oDpNZDqWhRWEtehSnX5NoCwJcXWWdO1ksKEUim6cQLP-VpQyuZTIIqwSADwgoe6ikxZG0NGvy5FijgxF4EW9zg39nhUNKRejYNHhOBZKIX38qYyXoB8XCVJybKg89aMMPsCT884F0CLBKbHeYhpYGmhE4YW~aV21c5pebivvxeJPWuTBAOmYxAIgJE3fFU-fucQn9YyGUFa8F3t-0Vco-9qVNSEWfgrdXOdKT6orr3sfssiKo3ybRWdTpxycZ6wB4qHWgTSU5A-gOA3ACTCMZBsASN3W5cz6GRZCspQ0HNu~R~nJ8V06Mmw~iVYOu5lDvipmG6-dJky6XRxCedczxMM1GWFoieQ8Ysfuxq-j8keEtaYmyUQme6TcviCEvQsxyVirr~dTC-F8aZ~y2AlG5IJz5KD02nO6TRkI2fgjHhv9OZ9nskh-I2jxAzFP6Is1kyAAAA";
    20         String goodB32 = "udhdrtrcetjm5sxzskjyr5ztpeszydbh4dpl3pl4utgqqw2v4jna.b32.i2p";
    21         // TODO: Come up with an actual bad b64 and b32
    22         String badB64 = "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA";
    23         String badB32 = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.b32.i2p";
    24 
     28    @Test
     29    public void lookupReturnsNullOnEmptyString() throws Exception {
    2530        DummyNamingService ns = new DummyNamingService(_context);
    2631
     
    2833        // TODO: Could this case ever come up?
    2934        //assertNull(ns.lookup(null));
     35    }
     36
     37    @Test
     38    public void lookupGoodDest() throws Exception {
     39        DummyNamingService ns = new DummyNamingService(_context);
    3040
    3141        Destination dGoodB64 = ns.lookup(goodB64);
     
    3343        // TODO: Check that the b64 is preserved.
    3444
    35         Destination dGoodB32 = ns.lookup(goodB32);
    36         assertNotNull(dGoodB32);
     45        // TODO: Mock out I2CP response
     46        //Destination dGoodB32 = ns.lookup(goodB32);
     47        //assertNotNull(dGoodB32);
    3748        // TODO: Check that the b32 is preserved.
    3849
     
    4051        //assertNull(ns.lookup(badB64));
    4152        //assertNull(ns.lookup(badB32));
     53    }
     54
     55    @Test
     56    public void lookupReturnsNullOnHostname() throws Exception {
     57        DummyNamingService ns = new DummyNamingService(_context);
    4258
    4359        // DummyNameService only handles b64 and b32 addresses
Note: See TracChangeset for help on using the changeset viewer.