diff --git a/LICENSE b/LICENSE index 24f377e..a72efbb 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2024 Antonio Gabriel Muñoz Conejo +Copyright (c) 2024 Antonio Gabriel Muñoz Conejo Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/src/main/java/com/github/tonivade/vavr/effect/CallStack.java b/src/main/java/com/github/tonivade/vavr/effect/CallStack.java index 84a71d9..ea68b7e 100644 --- a/src/main/java/com/github/tonivade/vavr/effect/CallStack.java +++ b/src/main/java/com/github/tonivade/vavr/effect/CallStack.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024, Antonio Gabriel Muñoz Conejo + * Copyright (c) 2024, Antonio Gabriel Muñoz Conejo * Distributed under the terms of the MIT License */ package com.github.tonivade.vavr.effect; diff --git a/src/main/java/com/github/tonivade/vavr/effect/Fiber.java b/src/main/java/com/github/tonivade/vavr/effect/Fiber.java index 6fcab2f..0a7a84c 100644 --- a/src/main/java/com/github/tonivade/vavr/effect/Fiber.java +++ b/src/main/java/com/github/tonivade/vavr/effect/Fiber.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024, Antonio Gabriel Muñoz Conejo + * Copyright (c) 2024, Antonio Gabriel Muñoz Conejo * Distributed under the terms of the MIT License */ package com.github.tonivade.vavr.effect; diff --git a/src/main/java/com/github/tonivade/vavr/effect/IO.java b/src/main/java/com/github/tonivade/vavr/effect/IO.java index 203e37e..57c36d5 100644 --- a/src/main/java/com/github/tonivade/vavr/effect/IO.java +++ b/src/main/java/com/github/tonivade/vavr/effect/IO.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024, Antonio Gabriel Muñoz Conejo + * Copyright (c) 2024, Antonio Gabriel Muñoz Conejo * Distributed under the terms of the MIT License */ package com.github.tonivade.vavr.effect; diff --git a/src/main/java/com/github/tonivade/vavr/effect/IOConnection.java b/src/main/java/com/github/tonivade/vavr/effect/IOConnection.java index 0f7816b..13584d0 100644 --- a/src/main/java/com/github/tonivade/vavr/effect/IOConnection.java +++ b/src/main/java/com/github/tonivade/vavr/effect/IOConnection.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024, Antonio Gabriel Muñoz Conejo + * Copyright (c) 2024, Antonio Gabriel Muñoz Conejo * Distributed under the terms of the MIT License */ package com.github.tonivade.vavr.effect; diff --git a/src/main/java/com/github/tonivade/vavr/effect/Reference.java b/src/main/java/com/github/tonivade/vavr/effect/Reference.java index c5d86ee..b6f0942 100644 --- a/src/main/java/com/github/tonivade/vavr/effect/Reference.java +++ b/src/main/java/com/github/tonivade/vavr/effect/Reference.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024, Antonio Gabriel Muñoz Conejo + * Copyright (c) 2024, Antonio Gabriel Muñoz Conejo * Distributed under the terms of the MIT License */ package com.github.tonivade.vavr.effect; diff --git a/src/main/java/com/github/tonivade/vavr/effect/Repeat.java b/src/main/java/com/github/tonivade/vavr/effect/Repeat.java index 3f4aeee..3262add 100644 --- a/src/main/java/com/github/tonivade/vavr/effect/Repeat.java +++ b/src/main/java/com/github/tonivade/vavr/effect/Repeat.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024, Antonio Gabriel Muñoz Conejo + * Copyright (c) 2024, Antonio Gabriel Muñoz Conejo * Distributed under the terms of the MIT License */ package com.github.tonivade.vavr.effect; diff --git a/src/main/java/com/github/tonivade/vavr/effect/Resource.java b/src/main/java/com/github/tonivade/vavr/effect/Resource.java index 2c438ae..2531dd3 100644 --- a/src/main/java/com/github/tonivade/vavr/effect/Resource.java +++ b/src/main/java/com/github/tonivade/vavr/effect/Resource.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024, Antonio Gabriel Muñoz Conejo + * Copyright (c) 2024, Antonio Gabriel Muñoz Conejo * Distributed under the terms of the MIT License */ package com.github.tonivade.vavr.effect; diff --git a/src/main/java/com/github/tonivade/vavr/effect/Retry.java b/src/main/java/com/github/tonivade/vavr/effect/Retry.java index 8c67c74..e1f4124 100644 --- a/src/main/java/com/github/tonivade/vavr/effect/Retry.java +++ b/src/main/java/com/github/tonivade/vavr/effect/Retry.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024, Antonio Gabriel Muñoz Conejo + * Copyright (c) 2024, Antonio Gabriel Muñoz Conejo * Distributed under the terms of the MIT License */ package com.github.tonivade.vavr.effect; diff --git a/src/main/java/com/github/tonivade/vavr/effect/Schedule.java b/src/main/java/com/github/tonivade/vavr/effect/Schedule.java index 949ccb8..1e81717 100644 --- a/src/main/java/com/github/tonivade/vavr/effect/Schedule.java +++ b/src/main/java/com/github/tonivade/vavr/effect/Schedule.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024, Antonio Gabriel Muñoz Conejo + * Copyright (c) 2024, Antonio Gabriel Muñoz Conejo * Distributed under the terms of the MIT License */ package com.github.tonivade.vavr.effect; diff --git a/src/main/java/com/github/tonivade/vavr/effect/StackItem.java b/src/main/java/com/github/tonivade/vavr/effect/StackItem.java index f567ecd..05456e7 100644 --- a/src/main/java/com/github/tonivade/vavr/effect/StackItem.java +++ b/src/main/java/com/github/tonivade/vavr/effect/StackItem.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024, Antonio Gabriel Muñoz Conejo + * Copyright (c) 2024, Antonio Gabriel Muñoz Conejo * Distributed under the terms of the MIT License */ package com.github.tonivade.vavr.effect; diff --git a/src/main/java/com/github/tonivade/vavr/effect/StateIO.java b/src/main/java/com/github/tonivade/vavr/effect/StateIO.java index 5ea5205..8066b9d 100644 --- a/src/main/java/com/github/tonivade/vavr/effect/StateIO.java +++ b/src/main/java/com/github/tonivade/vavr/effect/StateIO.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024, Antonio Gabriel Muñoz Conejo + * Copyright (c) 2024, Antonio Gabriel Muñoz Conejo * Distributed under the terms of the MIT License */ package com.github.tonivade.vavr.effect; diff --git a/src/main/java/com/github/tonivade/vavr/effect/Unit.java b/src/main/java/com/github/tonivade/vavr/effect/Unit.java index dce2be9..ec09f00 100644 --- a/src/main/java/com/github/tonivade/vavr/effect/Unit.java +++ b/src/main/java/com/github/tonivade/vavr/effect/Unit.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024, Antonio Gabriel Muñoz Conejo + * Copyright (c) 2024, Antonio Gabriel Muñoz Conejo * Distributed under the terms of the MIT License */ package com.github.tonivade.vavr.effect; diff --git a/src/test/java/com/github/tonivade/vavr/effect/IOTest.java b/src/test/java/com/github/tonivade/vavr/effect/IOTest.java index 6327c10..b25927d 100644 --- a/src/test/java/com/github/tonivade/vavr/effect/IOTest.java +++ b/src/test/java/com/github/tonivade/vavr/effect/IOTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024, Antonio Gabriel Muñoz Conejo + * Copyright (c) 2024, Antonio Gabriel Muñoz Conejo * Distributed under the terms of the MIT License */ package com.github.tonivade.vavr.effect; diff --git a/src/test/java/com/github/tonivade/vavr/effect/RefeferenceTest.java b/src/test/java/com/github/tonivade/vavr/effect/RefeferenceTest.java index 16d8744..31aed55 100644 --- a/src/test/java/com/github/tonivade/vavr/effect/RefeferenceTest.java +++ b/src/test/java/com/github/tonivade/vavr/effect/RefeferenceTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024, Antonio Gabriel Muñoz Conejo + * Copyright (c) 2024, Antonio Gabriel Muñoz Conejo * Distributed under the terms of the MIT License */ package com.github.tonivade.vavr.effect; diff --git a/src/test/java/com/github/tonivade/vavr/effect/ResourceTest.java b/src/test/java/com/github/tonivade/vavr/effect/ResourceTest.java index 59884a3..31c84d0 100644 --- a/src/test/java/com/github/tonivade/vavr/effect/ResourceTest.java +++ b/src/test/java/com/github/tonivade/vavr/effect/ResourceTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024, Antonio Gabriel Muñoz Conejo + * Copyright (c) 2024, Antonio Gabriel Muñoz Conejo * Distributed under the terms of the MIT License */ package com.github.tonivade.vavr.effect; @@ -23,7 +23,7 @@ @ExtendWith(MockitoExtension.class) class ResourceTest { - + private Resource makeResource(IO acquire) { return makeResource(acquire, AutoCloseable::close); } @@ -35,37 +35,37 @@ @Test void use(@Mock CheckedConsumer release) throws Throwable { Resource resource = makeResource(IO.pure("hola"), release); - + IO use = resource.use(string -> IO.pure(string.toUpperCase())); - + assertEquals("HOLA", use.unsafeRunSync()); verify(release).accept("hola"); } - + @Test void map(@Mock CheckedConsumer release) throws Throwable { Resource resource = makeResource(IO.pure("hola"), release).map(String::toUpperCase); - + IO use = resource.use(string -> IO.pure(string.length())); - + assertEquals(4, use.unsafeRunSync()); verify(release).accept("hola"); } - + @Test - void flatMap(@Mock DataSource dataSource, @Mock Connection connection, + void flatMap(@Mock DataSource dataSource, @Mock Connection connection, @Mock PreparedStatement statement, @Mock ResultSet resultSet) throws SQLException { when(dataSource.getConnection()).thenReturn(connection); when(connection.prepareStatement("sql")).thenReturn(statement); when(statement.executeQuery()).thenReturn(resultSet); when(resultSet.getString(0)).thenReturn("result"); - + Resource flatMap = makeResource(IO.task(dataSource::getConnection)) .flatMap(conn -> makeResource(IO.task(() -> conn.prepareStatement("sql")))) .flatMap(stmt -> makeResource(IO.task(() -> stmt.executeQuery()))); - + IO use = flatMap.use(rs -> IO.task(() -> rs.getString(0))); - + assertEquals("result", use.unsafeRunSync()); InOrder inOrder = inOrder(resultSet, statement, connection); inOrder.verify(resultSet).close(); @@ -77,9 +77,9 @@ void combine(@Mock CheckedConsumer release1, @Mock CheckedConsumer release2) throws Throwable { Resource res1 = makeResource(IO.pure("hola"), release1); Resource res2 = makeResource(IO.pure(5), release2); - + Resource> combine = res1.combine(res2); - + IO use = combine.use(tuple -> IO.task(tuple::toString)); assertEquals("(hola, 5)", use.unsafeRunSync()); diff --git a/src/test/java/com/github/tonivade/vavr/effect/ScheduleTest.java b/src/test/java/com/github/tonivade/vavr/effect/ScheduleTest.java index 00b06f2..58eaa64 100644 --- a/src/test/java/com/github/tonivade/vavr/effect/ScheduleTest.java +++ b/src/test/java/com/github/tonivade/vavr/effect/ScheduleTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024, Antonio Gabriel Muñoz Conejo + * Copyright (c) 2024, Antonio Gabriel Muñoz Conejo * Distributed under the terms of the MIT License */ package com.github.tonivade.vavr.effect;