Skip to content

Commit

Permalink
Add mockito-subclass artifact (#2821)
Browse files Browse the repository at this point in the history
Signed-off-by: Andriy Redko <andriy.redko@aiven.io>
  • Loading branch information
reta authored Dec 14, 2022
1 parent e2e6289 commit a4e2e48
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
strategy:
matrix:
java: [8, 11, 17]
mock-maker: ['mock-maker-default', 'mock-maker-inline']
mock-maker: ['mock-maker-default', 'mock-maker-inline', 'mock-maker-subclass']

# All build steps
# SINGLE-MATRIX-JOB means that the step does not need to be executed on every job in the matrix
Expand Down
3 changes: 2 additions & 1 deletion settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ plugins {
id("com.gradle.enterprise").version("3.3.4")
}

include("inline",
include("subclass",
"inline",
"proxy",
"extTest",
"groovyTest",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
member-accessor-module
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
mock-maker-subclass
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/*
* Copyright (c) 2022 Mockito contributors
* This program is made available under the terms of the MIT License.
*/
package org.mockitosubclass;

import org.junit.Test;
import org.mockito.internal.configuration.plugins.Plugins;
import org.mockito.internal.creation.bytebuddy.ByteBuddyMockMaker;
import org.mockito.internal.util.reflection.ModuleMemberAccessor;

import static org.junit.Assert.*;

public class PluginTest {

@Test
public void mock_maker_should_be_inline() throws Exception {
assertTrue(Plugins.getMockMaker() instanceof ByteBuddyMockMaker);
}

@Test
public void member_accessor_should_be_module() throws Exception {
assertTrue(Plugins.getMemberAccessor() instanceof ModuleMemberAccessor);
}

}
11 changes: 11 additions & 0 deletions subprojects/subclass/subclass.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
description = "Mockito preconfigured subclass mock maker"

apply from: "$rootDir/gradle/java-library.gradle"

dependencies {
api project.rootProject
testImplementation libraries.junit4
testImplementation libraries.assertj
}

tasks.javadoc.enabled = false

0 comments on commit a4e2e48

Please sign in to comment.