Source Code Cross Referenced for BasicMarkerTest.java in  » Development » SLF4J » org » slf4j » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Development » SLF4J » org.slf4j 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Copyright (c) 2004-2005 SLF4J.ORG
003:         * Copyright (c) 2004-2005 QOS.ch
004:         *
005:         * All rights reserved.
006:         *
007:         * Permission is hereby granted, free of charge, to any person obtaining
008:         * a copy of this software and associated documentation files (the
009:         * "Software"), to  deal in  the Software without  restriction, including
010:         * without limitation  the rights to  use, copy, modify,  merge, publish,
011:         * distribute, and/or sell copies of  the Software, and to permit persons
012:         * to whom  the Software is furnished  to do so, provided  that the above
013:         * copyright notice(s) and this permission notice appear in all copies of
014:         * the  Software and  that both  the above  copyright notice(s)  and this
015:         * permission notice appear in supporting documentation.
016:         *
017:         * THE  SOFTWARE IS  PROVIDED  "AS  IS", WITHOUT  WARRANTY  OF ANY  KIND,
018:         * EXPRESS OR  IMPLIED, INCLUDING  BUT NOT LIMITED  TO THE  WARRANTIES OF
019:         * MERCHANTABILITY, FITNESS FOR  A PARTICULAR PURPOSE AND NONINFRINGEMENT
020:         * OF  THIRD PARTY  RIGHTS. IN  NO EVENT  SHALL THE  COPYRIGHT  HOLDER OR
021:         * HOLDERS  INCLUDED IN  THIS  NOTICE BE  LIABLE  FOR ANY  CLAIM, OR  ANY
022:         * SPECIAL INDIRECT  OR CONSEQUENTIAL DAMAGES, OR  ANY DAMAGES WHATSOEVER
023:         * RESULTING FROM LOSS  OF USE, DATA OR PROFITS, WHETHER  IN AN ACTION OF
024:         * CONTRACT, NEGLIGENCE  OR OTHER TORTIOUS  ACTION, ARISING OUT OF  OR IN
025:         * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
026:         *
027:         * Except as  contained in  this notice, the  name of a  copyright holder
028:         * shall not be used in advertising or otherwise to promote the sale, use
029:         * or other dealings in this Software without prior written authorization
030:         * of the copyright holder.
031:         *
032:         */
033:        package org.slf4j;
034:
035:        import java.util.Iterator;
036:
037:        import junit.framework.TestCase;
038:
039:        import org.slf4j.helpers.BasicMarkerFactory;
040:
041:        /**
042:         * Unit test BasicMarker
043:         * 
044:         * @author Ceki Gülcü
045:         * @author Joern Huxhorn
046:         */
047:        public class BasicMarkerTest extends TestCase {
048:            static final String BLUE_STR = "BLUE";
049:            static final String RED_STR = "RED";
050:            static final String GREEN_STR = "GREEN";
051:            static final String COMP_STR = "COMP";
052:            static final String MULTI_COMP_STR = "MULTI_COMP";
053:            static final String PARENT_MARKER_STR = "PARENT_MARKER";
054:            static final String CHILD_MARKER_STR = "CHILD_MARKER";
055:
056:            final IMarkerFactory factory;
057:            final Marker blue;
058:            final Marker red;
059:            final Marker green;
060:            final Marker comp;
061:            final Marker multiComp;
062:
063:            public BasicMarkerTest() {
064:                factory = new BasicMarkerFactory();
065:
066:                blue = factory.getMarker(BLUE_STR);
067:                red = factory.getMarker(RED_STR);
068:                green = factory.getMarker(GREEN_STR);
069:                comp = factory.getMarker(COMP_STR);
070:                comp.add(blue);
071:
072:                multiComp = factory.getMarker(MULTI_COMP_STR);
073:                multiComp.add(green);
074:                multiComp.add(comp);
075:            }
076:
077:            public void testPrimitive() {
078:                assertEquals(BLUE_STR, blue.getName());
079:                assertTrue(blue.contains(blue));
080:
081:                Marker blue2 = factory.getMarker(BLUE_STR);
082:                assertEquals(BLUE_STR, blue2.getName());
083:                assertEquals(blue, blue2);
084:                assertTrue(blue.contains(blue2));
085:                assertTrue(blue2.contains(blue));
086:            }
087:
088:            public void testPrimitiveByName() {
089:                assertTrue(blue.contains(BLUE_STR));
090:            }
091:
092:            public void testComposite() {
093:                assertTrue(comp.contains(comp));
094:                assertTrue(comp.contains(blue));
095:            }
096:
097:            public void testCompositeByName() {
098:                assertTrue(comp.contains(COMP_STR));
099:                assertTrue(comp.contains(BLUE_STR));
100:            }
101:
102:            public void testMultiComposite() {
103:                assertTrue(multiComp.contains(comp));
104:                assertTrue(multiComp.contains(blue));
105:                assertTrue(multiComp.contains(green));
106:                assertFalse(multiComp.contains(red));
107:            }
108:
109:            public void testMultiCompositeByName() {
110:                assertTrue(multiComp.contains(COMP_STR));
111:                assertTrue(multiComp.contains(BLUE_STR));
112:                assertTrue(multiComp.contains(GREEN_STR));
113:                assertFalse(multiComp.contains(RED_STR));
114:            }
115:
116:            public void testMultiAdd() {
117:                Marker parent = factory.getMarker(PARENT_MARKER_STR);
118:                Marker child = factory.getMarker(CHILD_MARKER_STR);
119:                for (int i = 0; i < 10; i++) {
120:                    parent.add(child);
121:                }
122:
123:                // check that the child was added once and only once
124:                Iterator iterator = parent.iterator();
125:                assertTrue(iterator.hasNext());
126:                assertEquals(CHILD_MARKER_STR, iterator.next().toString());
127:                assertFalse(iterator.hasNext());
128:            }
129:
130:            public void testAddRemove() {
131:                final String NEW_PREFIX = "NEW_";
132:                Marker parent = factory.getMarker(NEW_PREFIX
133:                        + PARENT_MARKER_STR);
134:                Marker child = factory.getMarker(NEW_PREFIX + CHILD_MARKER_STR);
135:                assertFalse(parent.contains(child));
136:                assertFalse(parent.contains(NEW_PREFIX + CHILD_MARKER_STR));
137:                assertFalse(parent.remove(child));
138:
139:                parent.add(child);
140:
141:                assertTrue(parent.contains(child));
142:                assertTrue(parent.contains(NEW_PREFIX + CHILD_MARKER_STR));
143:
144:                assertTrue(parent.remove(child));
145:
146:                assertFalse(parent.contains(child));
147:                assertFalse(parent.contains(NEW_PREFIX + CHILD_MARKER_STR));
148:                assertFalse(parent.remove(child));
149:            }
150:
151:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.