Skip to content

Commit

Permalink
Fix more JUnit migration in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Doc94 committed Jul 23, 2024
1 parent 3751d4d commit 0f1a135
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 19 deletions.
11 changes: 5 additions & 6 deletions api/src/test/java/discord4j/store/api/service/StoreTests.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,15 @@
import discord4j.store.api.Store;
import discord4j.store.api.noop.NoOpStoreService;
import discord4j.store.api.primitive.ForwardingStoreService;
import org.junit.Assert;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;
import reactor.util.function.Tuple2;
import reactor.util.function.Tuples;

import java.util.*;

import static org.junit.Assert.*;
import static org.junit.jupiter.api.Assertions.*;

public class StoreTests {

Expand All @@ -41,15 +40,15 @@ private Store<String, String> newStore() {
@Test
public void testServiceDiscovery() {
assertTrue(provider.getStoreService() instanceof ForwardingStoreService);
Assert.assertEquals(TestService.class,
assertEquals(TestService.class,
((ForwardingStoreService) provider.getStoreService()).getOriginal().getClass());
}

@Test
public void testGenericFallback() {
assertTrue(provider.getStoreService() instanceof ForwardingStoreService);
assertTrue(provider.getStoreService().hasLongObjStores());
Assert.assertEquals(TestService.class,
assertEquals(TestService.class,
((ForwardingStoreService) provider.getStoreService()).getOriginal().getClass());
}

Expand All @@ -59,7 +58,7 @@ public void testOrder() {
override.put(TestService.class, Integer.MAX_VALUE);
override.put(NoOpStoreService.class, Integer.MIN_VALUE);
StoreServiceLoader overridden = new StoreServiceLoader(override);
Assert.assertEquals(TestService.class,
assertEquals(TestService.class,
((ForwardingStoreService) provider.getStoreService()).getOriginal().getClass());
assertEquals(NoOpStoreService.class, overridden.getStoreService().getClass());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,13 @@
*/
package discord4j.store.api.util;

import org.junit.Test;
import org.junit.jupiter.api.Test;
import reactor.util.function.Tuple2;
import reactor.util.function.Tuples;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertThrows;

public class LongObjTuple2Test {

Expand All @@ -36,9 +37,9 @@ public void testConstruction() {
assertEquals(obj, tuple.getT2());
}

@Test(expected = NullPointerException.class)
@Test
public void testNullObj() {
LongObjTuple2.of(key, null);
assertThrows(NullPointerException.class, () -> LongObjTuple2.of(key, null));
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@
*/
package discord4j.store.api.util;

import org.junit.Test;
import org.junit.jupiter.api.Test;

import java.util.Arrays;

import static org.junit.Assert.assertEquals;
import static org.junit.jupiter.api.Assertions.assertEquals;

public class MappingIterableTest {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,14 @@

package discord4j.store.crypto;

import org.junit.Test;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;

import javax.crypto.*;
import java.security.InvalidAlgorithmParameterException;
import java.security.InvalidKeyException;
import java.security.NoSuchAlgorithmException;

import static org.junit.Assert.assertEquals;

public class EncryptDecryptTest {

@Test
Expand All @@ -48,6 +47,6 @@ public void testEncryptDecryptStringUsingAES() throws NoSuchAlgorithmException,
" `8888> `888 \n" +
" \"8888 8% \n" +
" `\"888x:-\" ";
assertEquals(input, new String(AES.decrypt(AES.encrypt(input.getBytes(), skey), skey)));
Assertions.assertEquals(input, new String(AES.decrypt(AES.encrypt(input.getBytes(), skey), skey)));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@
import discord4j.discordjson.Id;
import discord4j.store.api.util.LongLongTuple2;
import org.assertj.core.api.Assertions;
import org.junit.Test;
import org.junit.jupiter.api.Test;

import java.util.HashSet;
import java.util.Set;

import static org.junit.Assert.assertEquals;
import static org.junit.jupiter.api.Assertions.assertEquals;

public class SerializerTests {

Expand Down

0 comments on commit 0f1a135

Please sign in to comment.