Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

implement assessment pass description, closes 202 #211

Merged
merged 14 commits into from
Dec 8, 2024
  •  
  •  
  •  
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
/*
* Copyright 2023 dmfs GmbH
*
* Copyright 2024 dmfs GmbH
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
Expand All @@ -13,7 +12,6 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/

package org.saynotobugs.confidence.asm;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
/*
* Copyright 2023 dmfs GmbH
*
* Copyright 2024 dmfs GmbH
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
Expand All @@ -13,7 +12,6 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/

package org.saynotobugs.confidence.asm;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
/*
* Copyright 2023 dmfs GmbH
*
* Copyright 2024 dmfs GmbH
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
Expand All @@ -13,7 +12,6 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/

package org.saynotobugs.confidence.asm.quality;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
/*
* Copyright 2023 dmfs GmbH
*
* Copyright 2024 dmfs GmbH
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
Expand All @@ -13,7 +12,6 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/

package org.saynotobugs.confidence.asm.quality;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
/*
* Copyright 2023 dmfs GmbH
*
* Copyright 2024 dmfs GmbH
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
Expand All @@ -13,7 +12,6 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/

package org.saynotobugs.confidence.asm.quality;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
/*
* Copyright 2023 dmfs GmbH
*
* Copyright 2024 dmfs GmbH
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
Expand All @@ -13,7 +12,6 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/

package org.saynotobugs.confidence.asm.quality;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
/*
* Copyright 2023 dmfs GmbH
*
* Copyright 2024 dmfs GmbH
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
Expand All @@ -13,7 +12,6 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/

package org.saynotobugs.confidence.asm.quality;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
/*
* Copyright 2023 dmfs GmbH
*
* Copyright 2024 dmfs GmbH
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
Expand All @@ -13,7 +12,6 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/

package org.saynotobugs.confidence.asm.quality;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
/*
* Copyright 2023 dmfs GmbH
*
* Copyright 2024 dmfs GmbH
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
Expand All @@ -13,7 +12,6 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/

package org.saynotobugs.confidence.asm.quality;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
/*
* Copyright 2023 dmfs GmbH
*
* Copyright 2024 dmfs GmbH
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
Expand All @@ -13,7 +12,6 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/

package org.saynotobugs.confidence.asm.quality;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
/*
* Copyright 2023 dmfs GmbH
*
* Copyright 2024 dmfs GmbH
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
Expand All @@ -13,7 +12,6 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/

package org.saynotobugs.confidence.asm.quality;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
/*
* Copyright 2023 dmfs GmbH
*
* Copyright 2024 dmfs GmbH
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
Expand All @@ -13,7 +12,6 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/

package org.saynotobugs.confidence.asm.quality;
Expand Down Expand Up @@ -42,8 +40,13 @@ void test()
{
assertThat(new ClassThat(new Has<>("annotations", ClassAdapter::declaredAnnotations, new Iterates<>(new InstanceOf<>(Annotation.class)))),
new AllOf<>(
new Passes<java.lang.Class<?>>(AnnotatedTestClass.class),
new Passes<java.lang.Class<?>>(OuterTestClass.AnnotatedInnerTestClass.class),
new Passes<java.lang.Class<?>>(AnnotatedTestClass.class, "Class that had annotations iterated [\n" +
" 0: instance of <class jdk.proxy3.$Proxy15>\n" +
"]"),
new Passes<java.lang.Class<?>>(OuterTestClass.AnnotatedInnerTestClass.class, "" +
"Class that had annotations iterated [\n" +
" 0: instance of <class jdk.proxy3.$Proxy15>\n" +
"]"),
new Fails<>(TestClassWithoutAnnotation.class, "Class that had annotations iterated [\n 0: missing instance of <interface java.lang.annotation.Annotation>\n]"),
new HasDescription("Class that has annotations iterates [\n 0: instance of <interface java.lang.annotation.Annotation>\n]")
));
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
/*
* Copyright 2023 dmfs GmbH
*
* Copyright 2024 dmfs GmbH
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
Expand All @@ -13,7 +12,6 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/

package org.saynotobugs.confidence.asm.quality;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
/*
* Copyright 2023 dmfs GmbH
*
* Copyright 2024 dmfs GmbH
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
Expand All @@ -13,7 +12,6 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/

package org.saynotobugs.confidence.asm.quality;
Expand Down Expand Up @@ -43,7 +41,7 @@ void test()
{
assertThat(new ClassThat(new HasDeclaredAnnotations(new Contains<>(new Annotation(TestAnnotation.class)))),
new AllOf<>(
new Passes<Class<?>>(AnnotatedTestClass.class),
new Passes<Class<?>>(AnnotatedTestClass.class, "Class that had annotations contained instance of <interface org.saynotobugs.confidence.asm.quality.testclasses.TestAnnotation>"),
new Fails<>(TestClassWithoutAnnotation.class, "Class that had annotations [] did not contain instance of <interface org.saynotobugs.confidence.asm.quality.testclasses.TestAnnotation>"),
new HasDescription("Class that has annotations contains instance of <interface org.saynotobugs.confidence.asm.quality.testclasses.TestAnnotation>")
));
Expand All @@ -53,11 +51,13 @@ void test()
void testWithDelegate()
{
assertThat(new ClassThat(new HasDeclaredAnnotations(new Contains<>(new Annotation(TestAnnotation.class,
new Has<>(TestAnnotation::defaultString, "def"))))),
new Has<>("defaultString", TestAnnotation::defaultString, "def"))))),
new AllOf<>(
new Passes<Class<?>>(AnnotatedTestClass.class),
new Fails<>(TestClassWithoutAnnotation.class, "Class that had annotations [] did not contain all of\n 0: instance of <interface org.saynotobugs.confidence.asm.quality.testclasses.TestAnnotation>\n 1: \"def\""),
new HasDescription("Class that has annotations contains all of\n 0: instance of <interface org.saynotobugs.confidence.asm.quality.testclasses.TestAnnotation>\n 1: \"def\"")
new Passes<Class<?>>(AnnotatedTestClass.class, "Class that had annotations contained all of\n" +
" 0: instance of <interface org.saynotobugs.confidence.asm.quality.testclasses.TestAnnotation>\n" +
" 1: has defaultString \"def\""),
new Fails<>(TestClassWithoutAnnotation.class, "Class that had annotations [] did not contain all of\n 0: instance of <interface org.saynotobugs.confidence.asm.quality.testclasses.TestAnnotation>\n 1: has defaultString \"def\""),
new HasDescription("Class that has annotations contains all of\n 0: instance of <interface org.saynotobugs.confidence.asm.quality.testclasses.TestAnnotation>\n 1: has defaultString \"def\"")
));
}

Expand All @@ -68,7 +68,10 @@ void testToString()
assertThat(new ClassThat(new HasDeclaredAnnotations(new Contains<>(new Annotation(FunctionalInterface.class,
new HasToString(FunctionalInterface.class.getCanonicalName()))))),
new AllOf<>(
new Passes<Class<?>>(FunctionalTestClass.class),
new Passes<Class<?>>(FunctionalTestClass.class, "" +
"Class that had annotations contained all of\n" +
" 0: instance of <interface java.lang.FunctionalInterface>\n" +
" 1: has toString() \"java.lang.FunctionalInterface\""),
new Fails<>(TestClassWithoutAnnotation.class, "Class that had annotations [] did not contain all of\n 0: instance of <interface java.lang.FunctionalInterface>\n 1: has toString() \"java.lang.FunctionalInterface\""),
new HasDescription("Class that has annotations contains all of\n 0: instance of <interface java.lang.FunctionalInterface>\n 1: has toString() \"java.lang.FunctionalInterface\"")
));
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
/*
* Copyright 2023 dmfs GmbH
*
* Copyright 2024 dmfs GmbH
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
Expand All @@ -13,7 +12,6 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/

package org.saynotobugs.confidence.asm.quality;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
/*
* Copyright 2023 dmfs GmbH
*
* Copyright 2024 dmfs GmbH
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
Expand All @@ -13,7 +12,6 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/

package org.saynotobugs.confidence.asm.quality.testclasses;
Expand Down
Loading
Loading