Package com.bj58.sfft.json.orgjson

Examples of com.bj58.sfft.json.orgjson.JSONObject


*/
public class PathMatcherTest {

    @Test
    public void test() {
        PathMatcher pathMatcher = new AntPathMatcher();

        String pattern = "/{a}/{b}/{c}";

        String sample = "/aa/bb/cc";

        Assert.assertTrue(pathMatcher.match(pattern, sample));

    }
View Full Code Here


    }


    @Test
    public void testPathMatch(){
        PathMatcher pathMatcher = new AntPathMatcher();
        String registeredPath = "/me/hello/{name}";
        String url = "/me/hello/renjun";
        Assert.assertTrue(pathMatcher.match(registeredPath, url));

        Map<String, String> values = pathMatcher.extractUriTemplateVariables(registeredPath, url);
        Assert.assertEquals(1, values.size());
        Assert.assertEquals("renjun", values.get("name"));

        System.out.println("OK testpathMatch");
View Full Code Here

        InputStream in = new BufferedInputStream(request.getInputStream());
        String content_type = request.getContentType();

        File tempDir = new File(config.getLocation());

        MultiPartInputStreamParser mpis = new MultiPartInputStreamParser(in, content_type, config, tempDir);
        mpis.setDeleteOnExit(true);
        return mpis;
    }
View Full Code Here

        InputStream in = new BufferedInputStream(super.getInputStream());
        String content_type = super.getContentType();

        File tempDir = new File(config.getLocation());

        multiParser = new MultiPartInputStreamParser(in, content_type, config, tempDir);
        multiParser.setDeleteOnExit(true);

        Collection<Part> parts = multiParser.getParts();

        int keyCount = queryStrings.size();
View Full Code Here

*/
public class EnterpriseUserTest {

  @Test
  public void TestUser() throws Exception {
    SESUser user = new SESUser();
    user.setUserID(1L);
    user.setState(1);

    Serializer serializer = new Serializer();
    byte[] buffer = serializer.Serialize(user);
    assertNotNull(buffer);
    Object obj = serializer.Derialize(buffer, SimpleClass.class);
View Full Code Here

      junit.framework.Assert.assertEquals(expected, actual);
    }

    TestEntity te = TestEntity.createInstrance();
    String jsonStr = JsonHelper.toJsonExt(te);
    JSONObject jsonObj = new JSONObject(jsonStr);

    Byte actual = new JsonConvert().convertToByte(jsonObj.get("fByte"));
    junit.framework.Assert.assertEquals(te.getFByte(), actual);
  }
View Full Code Here

      junit.framework.Assert.assertEquals(expected, actual);
    }

    TestEntity te = TestEntity.createInstrance();
    String jsonStr = JsonHelper.toJsonExt(te);
    JSONObject jsonObj = new JSONObject(jsonStr);

    Character actual = new JsonConvert().convertToCharacter(jsonObj
        .get("fCharacter"));
    junit.framework.Assert.assertEquals(te.getFCharacter(), actual);
  }
View Full Code Here

  }

  public void testConvertToString() throws Exception {
    TestEntity te = TestEntity.createInstrance();
    String jsonStr = JsonHelper.toJsonExt(te);
    JSONObject jsonObj = new JSONObject(jsonStr);

    String actual = new JsonConvert().convertToString(jsonObj
        .get("fString"));
    junit.framework.Assert.assertEquals(te.getFString(), actual);
  }
View Full Code Here

  }

  public void testConvertToboolean() throws Exception {
    TestEntity te = TestEntity.createInstrance();
    String jsonStr = JsonHelper.toJsonExt(te);
    JSONObject jsonObj = new JSONObject(jsonStr);

    boolean actual = new JsonConvert().convertToboolean(jsonObj
        .get("fboolean"));
    junit.framework.Assert.assertEquals(te.isFboolean(), actual);
  }
View Full Code Here

  }

  public void testConvertTobyte() throws Exception {
    TestEntity te = TestEntity.createInstrance();
    String jsonStr = JsonHelper.toJsonExt(te);
    JSONObject jsonObj = new JSONObject(jsonStr);

    byte actual = new JsonConvert().convertTobyte(jsonObj.get("fbyte"));
    junit.framework.Assert.assertEquals(te.getFbyte(), actual);
  }
View Full Code Here

TOP

Related Classes of com.bj58.sfft.json.orgjson.JSONObject

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.