@Test public void testGetThrowsISOException() throws Throwable { FSDMsg fSDMsg = new FSDMsg("testFSDMsgBasePath"); when(msg.get("testString")).thenReturn("<fsdmsg schem='"); fSDMsg.copy("testString", msg); try { fSDMsg.get("testFSDMsgId", "NB", 4, "testFSDMsgDefValue", null); fail("Expected ISOException to be thrown"); } catch (ISOException ex) { assertEquals("fSDMsg.fields.size()", 1, fSDMsg.fields.size()); } }
@Test public void testGet5() throws Throwable { FSDMsg fSDMsg = new FSDMsg("testFSDMsgBasePath", "testFSDMsgBaseSchema"); when(msg.get("testString")).thenReturn("testString"); fSDMsg.copy("testString", msg); String result = fSDMsg.get("testFSDMsgId", "N", 100, "testFSDMsgDefValue", null); assertEquals( "result", "0000000000000000000000000000000000000000000000000000000000000000000000000000000000testFSDMsgDefValue", result); assertEquals("fSDMsg.fields.size()", 1, fSDMsg.fields.size()); }
@Test public void testGet8() throws Throwable { FSDMsg fSDMsg = new FSDMsg("testFSDMsgBasePath", "testFSDMsgBaseSchema"); String result = fSDMsg.get("testFSDMsgId", "Kv", 100, "testFSDMsgDefValue", null); assertEquals("result", "testFSDMsgDefValue", result); assertEquals("fSDMsg.fields.size()", 0, fSDMsg.fields.size()); }
@Test public void testGet() throws Throwable { FSDMsg fSDMsg = new FSDMsg("testFSDMsgBasePath"); String result = fSDMsg.get("testFSDMsgFieldName"); assertNull("result", result); assertEquals("fSDMsg.fields.size()", 0, fSDMsg.fields.size()); }
@Test public void testGet4() throws Throwable { FSDMsg fSDMsg = new FSDMsg("testFSDMsgBasePath"); fSDMsg.set(" is used, but ", "testFSDMsgValue"); String result = fSDMsg.get(" is used, but ", "Kv", 100, "testFSDMsgDefValue", null); assertEquals("result", "testFSDMsgDefValue", result); assertEquals("fSDMsg.fields.size()", 1, fSDMsg.fields.size()); }
@Test public void testGetThrowsStringIndexOutOfBoundsException() throws Throwable { FSDMsg fSDMsg = new FSDMsg("testFSDMsgBasePath"); try { fSDMsg.get("testFSDMsgId", "", 100, "testFSDMsgDefValue", null); fail("Expected StringIndexOutOfBoundsException to be thrown"); } catch (StringIndexOutOfBoundsException ex) { assertEquals("ex.getMessage()", "String index out of range: 0", ex.getMessage()); assertEquals("fSDMsg.fields.size()", 0, fSDMsg.fields.size()); } }
@Test public void testGetThrowsRuntimeException9() throws Throwable { FSDMsg fSDMsg = new FSDMsg("testFSDMsgBasePath"); try { fSDMsg.get("testFSDMsgId", "", 100, null, null); fail("Expected RuntimeException to be thrown"); } catch (RuntimeException ex) { assertEquals("ex.getMessage()", "String index out of range: 0", ex.getMessage()); assertEquals("fSDMsg.fields.size()", 0, fSDMsg.fields.size()); } }
@Test public void testGetThrowsNullPointerException1() throws Throwable { FSDMsg fSDMsg = new FSDMsg("testFSDMsgBasePath", "testFSDMsgBaseSchema"); try { fSDMsg.get("testFSDMsgId", null, 100, "testFSDMsgDefValue", null); fail("Expected NullPointerException to be thrown"); } catch (NullPointerException ex) { assertNull("ex.getMessage()", ex.getMessage()); assertEquals("fSDMsg.fields.size()", 0, fSDMsg.fields.size()); } }
@Test public void testGetThrowsISOException1() throws Throwable { FSDMsg fSDMsg = new FSDMsg("testFSDMsgBasePath"); try { fSDMsg.get("testFSDMsgId", "NB", 0, "testFSDMsgDefValue", null); fail("Expected ISOException to be thrown"); } catch (ISOException ex) { assertEquals("ex.getMessage()", "invalid len 18/0", ex.getMessage()); assertNull("ex.getNested()", ex.getNested()); assertEquals("fSDMsg.fields.size()", 0, fSDMsg.fields.size()); } }
@Test public void testGetThrowsRuntimeException7() throws Throwable { FSDMsg fSDMsg = new FSDMsg("testFSDMsgBasePath"); try { fSDMsg.get("testFSDMsgId", "B]Z", 0, "testFSDMsgDefValue", "B]Z"); fail("Expected RuntimeException to be thrown"); } catch (RuntimeException ex) { assertEquals( "ex.getMessage()", "field content=testFSDMsgDefValue is too long to fit in field testFSDMsgId whose length is 0", ex.getMessage()); assertEquals("fSDMsg.fields.size()", 0, fSDMsg.fields.size()); } }
@Test public void testGetThrowsRuntimeException6() throws Throwable { FSDMsg fSDMsg = new FSDMsg("testFSDMsgBasePath"); try { fSDMsg.get("testFSDMsgId", "B]Z", 100, "testFSDMsgDefValue", "B]Z"); fail("Expected RuntimeException to be thrown"); } catch (RuntimeException ex) { assertEquals( "ex.getMessage()", "FSDMsg.isSeparated(String) found that B]Z has not been defined as a separator!", ex.getMessage()); assertEquals("fSDMsg.fields.size()", 0, fSDMsg.fields.size()); } }
@Test public void testGetThrowsRuntimeException4() throws Throwable { FSDMsg fSDMsg = new FSDMsg("testFSDMsgBasePath"); try { fSDMsg.get( "testFSDMsgId", "Ka`xc-3DywniD\"+9W\"Uh/mY~23E0(V)P_^sv )@", 100, null, "Ka`xc-3DywniD\"+9W\"Uh/mY~23E0(V)P_^sv )@"); fail("Expected RuntimeException to be thrown"); } catch (RuntimeException ex) { assertEquals( "ex.getMessage()", "FSDMsg.isSeparated(String) found that Ka`xc-3DywniD\"+9W\"Uh/mY~23E0(V)P_^sv )@ has not been defined as a separator!", ex.getMessage()); assertEquals("fSDMsg.fields.size()", 0, fSDMsg.fields.size()); } }
@Test public void testGet3() throws Throwable { FSDMsg fSDMsg = new FSDMsg("testFSDMsgBasePath"); fSDMsg.get("testFSDMsgId", "B", 100, "testFSDMsgDefValue", null); assertEquals("fSDMsg.fields.size()", 0, fSDMsg.fields.size()); }