-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry exported="true" kind="lib" path="lib/commons-logging-1.1.1.jar"/>
- <classpathentry exported="true" kind="lib" path="lib/commons-collections-3.2.1.jar"/>
- <classpathentry exported="true" kind="lib" path="lib/commons-pool-1.6.jar"/>
- <classpathentry exported="true" kind="lib" path="lib/commons-lang3-3.1.jar"/>
- <classpathentry exported="true" kind="lib" path="lib/commons-io-2.4.jar"/>
- <classpathentry exported="true" kind="lib" path="lib/freemarker.jar"/>
- <classpathentry exported="true" kind="lib" path="lib/log4j-1.2.17.jar"/>
- <classpathentry exported="true" kind="lib" path="lib/slf4j-api-1.6.4.jar"/>
- <classpathentry exported="true" kind="lib" path="lib/slf4j-log4j12-1.6.4.jar"/>
- <classpathentry exported="true" kind="lib" path="test/lib/junit-4.10.jar" sourcepath="test/lib/junit-4.10-src.jar"/>
- <classpathentry exported="true" kind="lib" path="test/lib/mockito-all-1.9.0.jar"/>
- <classpathentry kind="lib" path="test/lib/asm-4.0.jar"/>
- <classpathentry kind="lib" path="test/lib/asm-tree-4.0.jar"/>
- <classpathentry exported="true" kind="lib" path="test/lib/powermock-mockito-1.4.12-full.jar"/>
- <classpathentry exported="true" kind="lib" path="test/lib/javassist-3.16.1-GA.jar"/>
- <classpathentry kind="lib" path="lib/ant.jar"/>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
- <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
- <classpathentry kind="src" path="src"/>
- <classpathentry kind="src" path="test/src"/>
- <classpathentry kind="output" path="bin"/>
-</classpath>
+<?xml version="1.0" encoding="UTF-8"?>\r
+<classpath>\r
+ <classpathentry exported="true" kind="lib" path="lib/commons-logging-1.1.1.jar"/>\r
+ <classpathentry exported="true" kind="lib" path="lib/commons-collections-3.2.1.jar"/>\r
+ <classpathentry exported="true" kind="lib" path="lib/commons-pool-1.6.jar"/>\r
+ <classpathentry exported="true" kind="lib" path="lib/commons-lang3-3.1.jar"/>\r
+ <classpathentry exported="true" kind="lib" path="lib/commons-io-2.4.jar"/>\r
+ <classpathentry exported="true" kind="lib" path="lib/freemarker.jar"/>\r
+ <classpathentry exported="true" kind="lib" path="lib/log4j-1.2.17.jar"/>\r
+ <classpathentry exported="true" kind="lib" path="lib/slf4j-api-1.6.4.jar"/>\r
+ <classpathentry exported="true" kind="lib" path="lib/slf4j-log4j12-1.6.4.jar"/>\r
+ <classpathentry exported="true" kind="lib" path="test/lib/junit-4.10.jar" sourcepath="test/lib/junit-4.10-src.jar"/>\r
+ <classpathentry kind="lib" path="test/lib/asm-4.0.jar"/>\r
+ <classpathentry kind="lib" path="test/lib/asm-tree-4.0.jar"/>\r
+ <classpathentry exported="true" kind="lib" path="test/lib/javassist-3.16.1-GA.jar"/>\r
+ <classpathentry kind="lib" path="lib/ant.jar"/>\r
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>\r
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>\r
+ <classpathentry kind="src" path="src"/>\r
+ <classpathentry kind="src" path="test/src"/>\r
+ <classpathentry exported="true" kind="lib" path="test/lib/powermock-mockito-1.5-full.jar"/>\r
+ <classpathentry exported="true" kind="lib" path="test/lib/mockito-all-1.9.5.jar"/>\r
+ <classpathentry kind="output" path="bin"/>\r
+</classpath>\r
org.mockito.exceptions,
org.mockito.exceptions.base,
org.mockito.exceptions.misusing,
+ org.mockito.exceptions.stacktrace,
org.mockito.exceptions.verification,
org.mockito.exceptions.verification.junit,
org.mockito.internal,
org.mockito.internal.configuration,
org.mockito.internal.configuration.injection,
org.mockito.internal.configuration.injection.filter,
+ org.mockito.internal.configuration.injection.scanner,
org.mockito.internal.creation,
org.mockito.internal.creation.cglib,
org.mockito.internal.creation.jmock,
+ org.mockito.internal.creation.settings,
org.mockito.internal.debugging,
org.mockito.internal.exceptions,
- org.mockito.internal.exceptions.base,
+ org.mockito.internal.exceptions.stacktrace,
org.mockito.internal.exceptions.util,
+ org.mockito.internal.handler,
org.mockito.internal.invocation,
org.mockito.internal.invocation.finder,
org.mockito.internal.invocation.realmethod,
+ org.mockito.internal.junit,
org.mockito.internal.listeners,
org.mockito.internal.matchers,
org.mockito.internal.matchers.apachecommons,
org.mockito.internal.stubbing.answers,
org.mockito.internal.stubbing.defaultanswers,
org.mockito.internal.util,
+ org.mockito.internal.util.collections,
org.mockito.internal.util.junit,
org.mockito.internal.util.reflection,
org.mockito.internal.verification,
org.mockito.internal.verification.checkers,
org.mockito.invocation,
org.mockito.listeners,
+ org.mockito.mock,
+ org.mockito.plugins,
org.mockito.runners,
org.mockito.stubbing,
org.mockito.stubbing.answers,
org.powermock.api.mockito.internal,
org.powermock.api.mockito.internal.configuration,
org.powermock.api.mockito.internal.expectation,
- org.powermock.api.mockito.internal.invocationcontrol,
+ org.powermock.api.mockito.internal.invocation,
org.powermock.api.mockito.internal.mockcreation,
+ org.powermock.api.mockito.internal.mockmaker,
org.powermock.api.mockito.internal.verification,
org.powermock.api.mockito.mockpolicies,
org.powermock.api.mockito.powermocklistener,
</layout>
</appender>
- <logger name="org.tizen.common.util">
- <level value="info" />
- </logger>
-
<logger name="org.tizen.common.verrari.util">
<level value="info" />
</logger>
command.setFilter( null );
fail();
}
- catch ( NullPointerException e )
+ catch ( final IllegalArgumentException e )
{
// Then
}
factory.create( null );
fail();
}
- catch ( NullPointerException e )
+ catch ( final IllegalArgumentException e )
{
}
import java.util.Iterator;
import org.junit.Test;
+import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
*/
public class ArrayUtilTest
{
+ protected Logger logger = LoggerFactory.getLogger( getClass() );
+
public static int arrayIndex = 0;
public static boolean successTest = true;
}
catch( final IllegalArgumentException e )
{
- LoggerFactory.getLogger( getClass() ).info( "Test case successfult" );
+ logger.info( "Test case successfult" );
}
for ( Object[] input : inputArray ) {
int deleteCount = 0;
Object[] actualData = null;
try {
+ logger.trace( "{}: {}, {}", new Object[] { ObjectUtil.toString( input ), i, j } );
actualData = ArrayUtil.remove( input, i, j);
i = Math.max( 0, i );
if( j <= i) {
}
}
catch ( IllegalArgumentException e ) {
- if ( i >= j ) {
- continue;
- }
- else {
- fail("Failed remove(Object[], int, int) test");
- }
- }
- catch ( NullPointerException e ){
- if ( input == null) {
+ if ( null == input || i >= j ) {
continue;
}
else {
+ e.printStackTrace();
fail("Failed remove(Object[], int, int) test");
}
}
*/
package org.tizen.common.util;
+import static org.powermock.api.mockito.PowerMockito.whenNew;
+
+import java.io.FileReader;
+import java.io.IOException;
+
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.powermock.api.mockito.PowerMockito;
+import org.powermock.core.classloader.annotations.PrepareForTest;
+import org.powermock.modules.junit4.PowerMockRunner;
+@RunWith( PowerMockRunner.class )
+@PrepareForTest( { HostUtil.class } )
public class HostUtilTest {
private String packageName = HostUtilTest.class.getPackage().getName().replace('.', '/');
*
* @see HostUtil#getContents( String)
*/
+ @SuppressWarnings("unchecked")
@Test
public void test_getContents() throws Exception {
+ FileReader file = PowerMockito.mock( FileReader.class );
+ whenNew( FileReader.class ).withParameterTypes( String.class ).withArguments( fullPath ).thenReturn( file );
Assert.notNull(HostUtil.getContents(fullPath));
- Assert.isNull(HostUtil.getContents(null));
+
+ whenNew( FileReader.class ).withParameterTypes( String.class ).withArguments( "nullPath" ).thenThrow( IOException.class );
Assert.isNull(HostUtil.getContents("nullPath"));
}