libeufin

Integration and sandbox testing for FinTech APIs and data formats
Log | Files | Refs | Submodules | README | LICENSE

DatabaseTest.kt (1385B)


      1 /*
      2  * This file is part of LibEuFin.
      3  * Copyright (C) 2024-2025 Taler Systems S.A.
      4 
      5  * LibEuFin is free software; you can redistribute it and/or modify
      6  * it under the terms of the GNU Affero General Public License as
      7  * published by the Free Software Foundation; either version 3, or
      8  * (at your option) any later version.
      9 
     10  * LibEuFin is distributed in the hope that it will be useful, but
     11  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
     12  * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Affero General
     13  * Public License for more details.
     14 
     15  * You should have received a copy of the GNU Affero General Public
     16  * License along with LibEuFin; see the file COPYING.  If not, see
     17  * <http://www.gnu.org/licenses/>
     18  */
     19 
     20 import org.junit.Test
     21 import tech.libeufin.common.*
     22 import tech.libeufin.common.db.*
     23 import tech.libeufin.ebics.*
     24 import tech.libeufin.ebisync.db.*
     25 import java.time.Instant
     26 import java.util.UUID;
     27 import kotlin.test.*
     28 
     29 class EbicsTxTest {
     30     // Test pending transaction's id
     31     @Test
     32     fun pending() = setup { db, _ ->
     33         val ids = setOf("first", "second", "third")
     34         for (id in ids) {
     35             db.ebics.register(id)
     36         }
     37 
     38         repeat(ids.size) {
     39             val id = db.ebics.first()
     40             assert(ids.contains(id))
     41             db.ebics.remove(id!!)
     42         }
     43 
     44         assertNull(db.ebics.first())
     45     }
     46 }