Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9192545
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T20:57:01+00:00 2026-06-17T20:57:01+00:00

I’m writing an acceptance test using Specs2. I want to use ImpermanentGraphDatabase in order

  • 0

I’m writing an acceptance test using Specs2.

I want to use ImpermanentGraphDatabase in order to have an in-memory Neo4j graph; ideal for integration testing.

I set up Spring-Data for Neo4j and my Spring file configuration contains:

<bean id="graphDatabaseService" class="org.neo4j.test.ImpermanentGraphDatabase" destroy-method="shutdown"/>

I wonder whether the option destroy-method="shutdown"is taking in account with Specs2 instead of usual JUnit, in order to isolate each Spec’s example.

To sum up: Would each example have its own in-memory graph instance or it would be shared to all of them?

I guess that it’s not applicable since specs2 use the same Specification instance for all these Spec’s examples execution. Indeed, with the Specs2’s functional style, only is() method is called englobing all examples in one instance.

I tried also to implement the BeforeExample trait in order to clean database at each example but… with a Given/Then/When style, it seems that the whole is considered as a unique example. Indeed, the separator is ^ instead of traditional !, the latter representing one example.

I would like to clean in-memory database (ImpermanentGraphDatabse) before each step (Given or When or Then step)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T20:57:02+00:00Added an answer on June 17, 2026 at 8:57 pm

    My understanding of your problem is that you want a “fresh” database before each group of Given/When/Then steps.

    In order to do this you can either:

    • specify the action explicitly before each group of Given/When/Then steps

      Step(cleanupDatabase) ^
      "A given-when-then example for the addition" ^
        "Given the following number: ${1}"         ^ number1 ^
        "And a second number: ${2}"                ^ number2 ^
        "And a third number: ${3}"                 ^ number3 ^
                                                   end^
      Step(cleanupDatabase) ^
      "A given-when-then example for the addition" ^
       "Given the following number: ${1}"         ^ number1 ^
       "And a second number: ${2}"                ^ number2 ^
       "And a third number: ${3}"                 ^ number3 ^
                                               end
      
    • use functions to declare each group and map a cleanup step before each

      def `first example` =     
        "A given-when-then example for the addition" ^
          "Given the following number: ${1}"         ^ number1 ^
          "And a second number: ${2}"                ^ number2 ^
          "And a third number: ${3}"                 ^ number3 ^
                                                     end
      def `second example` =     
        "A given-when-then example for the addition" ^
          "Given the following number: ${1}"         ^ number1 ^
          "And a second number: ${2}"                ^ number2 ^
          "And a third number: ${3}"                 ^ number3 ^
                                                     end
      
      def is = Seq(`first example`, `second example`).foldLeft(Step():Fragments) { (res, cur) =>
        res ^ Step(cleanupDatabase) ^ cur 
      }
      
    • use the map function of the Specification to do it generically

      override def map(fs: =>Fragments) = fs.flatMap {
        // clean the database at the end of a G/W/T block
        case f if f == end => Seq(Step(cleanDatabase), end)
        case other         => Seq(other)    
      }
      
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a French site that I want to parse, but am running into
I want use html5's new tag to play a wav file (currently only supported
I have thousands of HTML files to process using Groovy/Java and I need to
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and
I want to count how many characters a certain string has in PHP, but
I am trying to understand how to use SyndicationItem to display feed which is

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.