|
| 1 | +/* |
| 2 | + * Copyright (c) "Neo4j" |
| 3 | + * Neo4j Sweden AB [http://neo4j.com] |
| 4 | + * |
| 5 | + * This file is part of Neo4j. |
| 6 | + * |
| 7 | + * Neo4j is free software: you can redistribute it and/or modify |
| 8 | + * it under the terms of the GNU General Public License as published by |
| 9 | + * the Free Software Foundation, either version 3 of the License, or |
| 10 | + * (at your option) any later version. |
| 11 | + * |
| 12 | + * This program is distributed in the hope that it will be useful, |
| 13 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 15 | + * GNU General Public License for more details. |
| 16 | + * |
| 17 | + * You should have received a copy of the GNU General Public License |
| 18 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 19 | + */ |
| 20 | + |
| 21 | +import org.junit.jupiter.api.Assertions; |
| 22 | +import org.junit.jupiter.api.Test; |
| 23 | +import org.neo4j.gds.config.RandomSeedConfig; |
| 24 | + |
| 25 | +import java.util.Collections; |
| 26 | +import java.util.Map; |
| 27 | +import java.util.Optional; |
| 28 | + |
| 29 | +class RandomSeedConfigTest { |
| 30 | + |
| 31 | + @Test |
| 32 | + void shouldAcceptInt() { |
| 33 | + var config = RandomSeedConfig.of(Map.of("randomSeed", 42)); |
| 34 | + Assertions.assertEquals(42L, config.randomSeed().get()); |
| 35 | + } |
| 36 | + |
| 37 | + @Test |
| 38 | + void shouldAcceptLong() { |
| 39 | + var config = RandomSeedConfig.of(Map.of("randomSeed", 42L)); |
| 40 | + Assertions.assertEquals(42L, config.randomSeed().get()); |
| 41 | + } |
| 42 | + |
| 43 | + @Test |
| 44 | + void shouldAcceptEmpty() { |
| 45 | + var config = RandomSeedConfig.of(Collections.emptyMap()); |
| 46 | + Assertions.assertEquals(Optional.empty(), config.randomSeed()); |
| 47 | + } |
| 48 | +} |
0 commit comments