#NEWLINE# def test_java_dependencies_detected( self ) : #NEWLINE# #INDENT# response = Response ( ) #NEWLINE# response . status_code = 0 #NEWLINE# self . patched [ 'wakatime.packages.requests.adapters.HTTPAdapter.send' ] . return_value = response #NEWLINE# now = u ( int ( time . time ( ) ) ) #NEWLINE# entity = 'tests/samples/codefiles/java.java' #NEWLINE# config = 'tests/samples/configs/good_config.cfg' #NEWLINE# args = [ '--file' , entity , '--config' , config , '--time' , now ] #NEWLINE# retval = execute ( args ) #NEWLINE# self . assertEquals ( retval , 102 ) #NEWLINE# self . assertEquals ( sys . stdout . getvalue ( ) , '' ) #NEWLINE# self . assertEquals ( sys . stderr . getvalue ( ) , '' ) #NEWLINE# self . patched [ 'wakatime.session_cache.SessionCache.get' ] . assert_called_once_with ( ) #NEWLINE# self . patched [ 'wakatime.session_cache.SessionCache.delete' ] . assert_called_once_with ( ) #NEWLINE# self . patched [ 'wakatime.session_cache.SessionCache.save' ] . assert_not_called ( ) #NEWLINE# heartbeat = { #NEWLINE# #INDENT# 'language' : u ( 'Java' ) , #NEWLINE# 'lines' : 20 , #NEWLINE# 'entity' : os . path . realpath ( entity ) , #NEWLINE# 'project' : u ( os . path . basename ( os . path . realpath ( '.' ) ) ) , #NEWLINE# 'dependencies' : ANY , #NEWLINE# 'branch' : os . environ . get ( 'TRAVIS_COMMIT' , ANY ) , #NEWLINE# 'time' : float ( now ) , #NEWLINE# 'type' : 'file' , #NEWLINE# #UNINDENT# } #NEWLINE# stats = { #NEWLINE# #INDENT# u ( 'cursorpos' ) : None , #NEWLINE# u ( 'dependencies' ) : ANY , #NEWLINE# u ( 'language' ) : u ( 'Java' ) , #NEWLINE# u ( 'lineno' ) : None , #NEWLINE# u ( 'lines' ) : 20 , #NEWLINE# #UNINDENT# } #NEWLINE# expected_dependencies = [ 'googlecode.javacv' , 'colorfulwolf.webcamapplet' , 'foobar' ] #NEWLINE# self . patched [ 'wakatime.offlinequeue.Queue.push' ] . assert_called_once_with ( heartbeat , ANY , None ) #NEWLINE# dependencies = self . patched [ 'wakatime.offlinequeue.Queue.push' ] . call_args [ 0 ] [ 0 ] [ 'dependencies' ] #NEWLINE# self . assertListsEqual ( dependencies , expected_dependencies ) #NEWLINE# self . assertEquals ( stats , json . loads ( self . patched [ 'wakatime.offlinequeue.Queue.push' ] . call_args [ 0 ] [ 1 ] ) ) #NEWLINE# self . patched [ 'wakatime.offlinequeue.Queue.pop' ] . assert_not_called ( )