Beispiel #1
0
 @Test
 public void testConvertVersionToApplication() {
   assertTrue(Utils.convertVersionToApplication(null).equals(""));
   assertTrue(Utils.convertVersionToApplication("").equals(""));
   assertTrue(Utils.convertVersionToApplication("Foo").equals("Foo"));
   assertTrue(Utils.convertVersionToApplication("Foo,").equals("Foo"));
   assertTrue(Utils.convertVersionToApplication("Foo,Bar").equals("Foo"));
   assertTrue(Utils.convertVersionToApplication("Foo, Bar").equals("Foo"));
   assertTrue(
       Utils.convertVersionToApplication("Foo.Bar,Foo.FooBar,Foo.FooBarBar,").equals("Foo.Bar"));
 }
Beispiel #2
0
 @Test
 public void testConvertToDoubleQuotedString() {
   assertTrue(Utils.convertToDoubleQuotedString(null).length() == 0);
   assertTrue(Utils.convertToDoubleQuotedString("").equalsIgnoreCase("\"\""));
   assertTrue(Utils.convertToDoubleQuotedString("Foo").equalsIgnoreCase("\"Foo\""));
   assertTrue(Utils.convertToDoubleQuotedString("Foo.Bar").equalsIgnoreCase("\"Foo.Bar\""));
   assertTrue(Utils.convertToDoubleQuotedString("Foo'").equalsIgnoreCase("\"Foo'\""));
   // cases for testing the value which already enclosed with double quotes
   assertTrue(Utils.convertToDoubleQuotedString("\"Foo\"").equalsIgnoreCase("\"Foo\""));
   assertTrue(Utils.convertToDoubleQuotedString("\"Foo\"Bar\"").equalsIgnoreCase("\"Foo\"Bar\""));
 }
Beispiel #3
0
 @Test
 public void testRemoveFileExtention() {
   try {
     Utils.removeFileExtention("", "");
     fail("Illegal Argument exception should be thrown!");
   } catch (IllegalArgumentException e) {
     assertTrue(true);
   }
   try {
     Utils.removeFileExtention("Foo.event", "eve");
     fail("Illegal Argument exception should be thrown!");
   } catch (IllegalArgumentException e) {
     assertTrue(true);
   }
   try {
     Utils.removeFileExtention("Foo.event", "Event");
     fail("Illegal Argument exception should be thrown!");
   } catch (IllegalArgumentException e) {
     assertTrue(true);
   }
   assertTrue(Utils.removeFileExtention("Foo.event", "event").equals("Foo"));
 }
Beispiel #4
0
  @Test
  public void testGetSchemaName() {
    assertNull(Utils.getSchemaName(null));
    assertTrue(Utils.getSchemaName("").equals(""));
    assertTrue(Utils.getSchemaName("  ").equals("  "));
    assertTrue(Utils.getSchemaName(".").equals("."));
    assertTrue(Utils.getSchemaName("..").equals(".."));
    assertTrue(Utils.getSchemaName(".......").equals("......."));

    // not contains . symbol
    assertTrue(Utils.getSchemaName("FOOBAR").equals("foobar"));
    assertTrue(Utils.getSchemaName("@ID").equals("id"));
    assertTrue(Utils.getSchemaName("~`!@#$%^&+{}|\\/?,<>*+-_").equals("_"));

    // . symbol at starting of the string
    assertTrue(Utils.getSchemaName(".FOOBAR").equals("Foobar"));
    // . symbol at end of the string
    assertTrue(Utils.getSchemaName("FOOBAR.").equals("foobar"));
    // . symbol in between of each and every character
    assertTrue(Utils.getSchemaName(".F.O.O.B.A.R").equals("FOOBAR"));
    assertTrue(Utils.getSchemaName("F.O.O.B.A.R").equals("fOOBAR"));

    assertTrue(Utils.getSchemaName("FOO.BAR").equals("fooBar"));
    assertTrue(Utils.getSchemaName("FOO.BAR FOOBAR").equals("fooBarfoobar"));
    assertTrue(Utils.getSchemaName("Foo.#Bar_FooBar").equals("foobar_foobar"));
    assertTrue(Utils.getSchemaName("1Foo.Bar").equals("fooBar"));
    assertTrue(Utils.getSchemaName("Foo.Bar1").equals("fooBar1"));
    assertTrue(Utils.getSchemaName("Foo.Bar$Bar").equals("fooBarbar"));

    // test to some odd field names
    assertTrue(Utils.getSchemaName("HDR.1.040..078").equals("hdr1040078"));
    assertTrue(Utils.getSchemaName("HDR....1.0....40..078").equals("hdr1040078"));
  }
Beispiel #5
0
  @Test
  public void testContainsValidChar() {
    assertFalse(Utils.containsValidChar(" "));
    assertFalse(Utils.containsValidChar("!Foo@"));
    assertFalse(Utils.containsValidChar("******"));
    assertFalse(Utils.containsValidChar("Foo.Bar"));
    assertFalse(Utils.containsValidChar("Foo Bar"));
    assertFalse(Utils.containsValidChar("FooBar "));
    assertFalse(Utils.containsValidChar("Foo	Bar"));
    assertFalse(Utils.containsValidChar("Foo$Bar"));

    assertTrue(Utils.containsValidChar("Foo"));
    assertFalse(Utils.containsValidChar("Foo_Bar"));
    assertFalse(Utils.containsValidChar("_FooBar"));
    assertTrue(Utils.containsValidChar("FooBar1"));
    assertTrue(Utils.containsValidChar("Foo1Foo"));
    assertTrue(Utils.containsValidChar("foobar"));
    assertTrue(Utils.containsValidChar("foo"));
    assertTrue(Utils.containsValidChar("enquiryNumber"));
  }