1 package com.openedit.archive.update; 2 3 import java.util.ArrayList ; 4 import java.util.List ; 5 6 public class FunctionalTest extends ArcUpdateTestCase { 7 public static final String _TIFF = "etc\\test.tiff"; 8 9 MetadataUpdater main = new MetadataUpdater(); 10 11 List keywords = new ArrayList (); 12 13 public FunctionalTest(String inArg0) { 14 super(inArg0); 15 } 16 17 protected void setUp() throws Exception { 18 super.setUp(); 19 main = new MetadataUpdater(); 20 keywords = new ArrayList (); 21 removeKeywords(_TIFF); 22 } 23 24 public void testAddKeywords() throws Exception { 25 keywords.add("one"); 26 keywords.add("two,things"); 28 keywords.add("three"); 29 ExifEditBuilder exif = new ExifEditBuilder(_TIFF); 30 exif.setKeys(keywords); 31 boolean actual = main.addKeywords(exif); 32 assertTrue(actual); 33 List output = findKeywords(_TIFF).getOutput(); 34 assertListContains("one", output); 35 assertListContains("two,things", output); 36 37 } 41 42 public void testAddComment() throws Exception { 43 keywords.add("one"); 44 ExifEditBuilder exif = new ExifEditBuilder(_TIFF); 45 exif.setKeys(keywords); 46 final String COMMENT = "This, That, The other"; 47 exif.setComments(COMMENT); 48 49 boolean actual = main.addKeywords(exif); 51 assertTrue(actual); 52 53 List commentOutput = findComment(_TIFF).getOutput(); 55 assertListContains(COMMENT, commentOutput); 56 } 57 58 public void testAddInvalidKeywords() throws Exception { 59 keywords.add("one"); 60 keywords.add("two;parts"); 61 keywords.add("three"); 62 ExifEditBuilder exif = new ExifEditBuilder(_TIFF); 63 exif.setKeys(keywords); 64 boolean actual = main.addKeywords(exif); 65 assertFalse(actual); 66 List output = findKeywords(_TIFF).getOutput(); 67 assertListDoesNotContain("one", output); 68 assertListDoesNotContain("two", output); 69 assertListDoesNotContain("two;parts", output); 70 } 71 } 72 | Popular Tags |