So there is a method

def getYahooFinanceDataAndSaveToDB() { String url = 'http://finance.yahoo.com/d/quotes.csv?s=AAPL+GOOG+MSFT&f=nab' Date dt = new java.util.Date() String content = url.toURL().getText(); // render content ArrayList<String> list = content.split("\n"); for (String i : list) { def count=Counter.get('QN_ID') assert 'QN_ID' == count.name count.value+=1 // render count.value MyData date = new MyData(Id:count.value ,Data: i, RecordCreateDate: dt) date.save() count.save() } } 

I wrote about this test with the launch of threads

 def "Run 10 concurrent threads that call the method 50 times each"() { given: int count = 0; for (int i=0; i<10;i++){ Thread x = new Thread() x.run() for (int j=0; j<50;j++){ def service = new YahooReaderService(); def meth = service.yahooFinanceDataAndSaveToDB count+=1 } } when: assertEquals(count, 250) then: "true" } 

Swears at the string def count = Counter.get ('QN_ID') which requests data from the database

 groovy.lang.MissingMethodException: No signature of method: yahooreader.Counter.get() is applicable for argument types: () values: [] Possible solutions: get(java.io.Serializable), getId(), grep(), getAt(java.lang.String), grep(java.lang.Object), wait() 

How to write a Mosk cap for writing and reading from the database in this case?

    0