Skip to content

Commit

Permalink
Merge pull request #66 from raner/issue-65-fix-build-problem
Browse files Browse the repository at this point in the history
Issue #65: rename pro.projo.interfaces.annotation package in test folder
  • Loading branch information
raner authored Jan 12, 2021
2 parents 764c5d9 + 293328b commit c93ab54
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 12 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// //
// Copyright 2018 Mirko Raner //
// Copyright 2018 - 2021 Mirko Raner //
// //
// Licensed under the Apache License, Version 2.0 (the "License"); //
// you may not use this file except in compliance with the License. //
Expand All @@ -13,18 +13,20 @@
// See the License for the specific language governing permissions and //
// limitations under the License. //
// //
package pro.projo.interfaces.annotation;
package pro.projo.interfaces.annotations;

import java.util.concurrent.Callable;
import java.util.function.Function;
import java.util.function.Predicate;
import java.util.stream.Stream;
import org.junit.Test;
import static javax.lang.model.element.Modifier.PUBLIC;
import static javax.lang.model.element.Modifier.STATIC;
import pro.projo.interfaces.annotation.Interface;
import pro.projo.interfaces.annotation.Interfaces;
import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static pro.projo.interfaces.annotation.Ternary.TRUE;
import static pro.projo.interfaces.annotation.Visibility.PUBLIC;

public class InterfaceTest
{
Expand All @@ -43,15 +45,16 @@ public void testInterfaceAnnotationForCallable()
Interface callable = Stream.of(interfaces.value()).filter(equals(Interface::generate, "Callable")).findFirst().get();
assertEquals(Callable.class, callable.from());
}

@Test
public void testInterfaceAnnotationForMath()
{
Package testPackage = getClass().getPackage();
Interfaces interfaces = testPackage.getAnnotation(Interfaces.class);
Interface math = Stream.of(interfaces.value()).filter(equals(Interface::generate, "Math")).findFirst().get();
Object[][] expected = {{Math.class}, {PUBLIC, STATIC}};
assertArrayEquals(expected, new Object[] {new Object[] {math.from()}, math.modifiers()});
Object[][] expected = {{Math.class}, {TRUE}, {PUBLIC}};
Object[][] actual = {{math.from()}, {math.isStatic()}, math.visibility()};
assertArrayEquals(expected, actual);
}

private <I, T> Predicate<I> equals(Function<I, T> method, T value)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// //
// Copyright 2018 Mirko Raner //
// Copyright 2018 - 2021 Mirko Raner //
// //
// Licensed under the Apache License, Version 2.0 (the "License"); //
// you may not use this file except in compliance with the License. //
Expand All @@ -14,12 +14,13 @@
// limitations under the License. //
// //
@Interface(generate="Callable", from=Callable.class)
@Interface(generate="Math", from=Math.class, modifiers={PUBLIC, STATIC})
package pro.projo.interfaces.annotation;
@Interface(generate="Math", from=Math.class, isStatic=TRUE, visibility=PUBLIC)
package pro.projo.interfaces.annotations;

import java.util.concurrent.Callable;
import static javax.lang.model.element.Modifier.PUBLIC;
import static javax.lang.model.element.Modifier.STATIC;
import pro.projo.interfaces.annotation.Interface;
import static pro.projo.interfaces.annotation.Ternary.TRUE;
import static pro.projo.interfaces.annotation.Visibility.PUBLIC;

/**
* This {@code package-info} class contains the annotations that are tested by the
Expand Down

0 comments on commit c93ab54

Please sign in to comment.