Skip to content

Commit c62e5ac

Browse files
committed
Increase coverage of EBean Tests.
1 parent f0dd435 commit c62e5ac

6 files changed

Lines changed: 149 additions & 2 deletions

File tree

‎AndroidAnnotations/androidannotations-core/androidannotations/src/test/java/org/androidannotations/ebean/EBeanTest.java‎

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,23 @@ public void setUp() {
3131

3232
@Test
3333
public void activitySubclassInManifestCompiles() {
34-
assertCompilationSuccessful(compileFiles(SomeActivity.class, SomeImplementation.class, SingletonBean.class, SomeGenericBean.class, SomeGenericBeanExt.class));
34+
assertCompilationSuccessful(compileFiles(SomeActivity.class, SomeImplementation.class, SomeGenericBean.class, SomeGenericBeanExt.class, SingletonBean.class, SomeBeanWithEmptyConstructor.class,
35+
SomeBeanWithContextParamConstructor.class));
3536
}
3637

3738
@Test
3839
public void eBeanOnInterfaceDoesNotCompile() {
3940
assertCompilationError(compileFiles(InterfaceWithEBean.class));
4041
}
4142

43+
@Test
44+
public void eBeanWithContextAndNoParamsConstructorsCompile() {
45+
assertCompilationSuccessful(compileFiles(SomeBeanWithEmptyConstructor.class, SomeBeanWithContextParamConstructor.class));
46+
}
47+
48+
@Test
49+
public void eBeanWithNonContextOnlyConstructorsDoesNotCompile() {
50+
assertCompilationError(compileFiles(SomeBeanWithNonContextConstructors.class, SomeBeanWithContextAndNoParamsConstructors.class));
51+
}
52+
4253
}

‎AndroidAnnotations/androidannotations-core/androidannotations/src/test/java/org/androidannotations/ebean/SomeActivity.java‎

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
/**
22
* Copyright (C) 2010-2016 eBusiness Information, Excilys Group
3+
* Copyright (C) 2016-2019 the AndroidAnnotations project
34
*
45
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
56
* use this file except in compliance with the License. You may obtain a copy of
@@ -30,9 +31,18 @@ public class SomeActivity extends Activity {
3031

3132
@Bean
3233
@NonConfigurationInstance
33-
SingletonBean maintainedSingeltonDependency;
34+
SingletonBean maintainedSingletonDependency;
3435

3536
@Bean
3637
SomeGenericBean<Object> objectSomeGenericBean;
3738

39+
@Bean
40+
SomeGenericBeanExt someGenericBeanExt;
41+
42+
@Bean
43+
SomeBeanWithEmptyConstructor beanWithEmptyConstructor;
44+
45+
@Bean
46+
SomeBeanWithContextParamConstructor beanWithContextParamConstructor;
47+
3848
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
/**
2+
* Copyright (C) 2016-2019 the AndroidAnnotations project
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
5+
* use this file except in compliance with the License. You may obtain a copy of
6+
* the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed To in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12+
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13+
* License for the specific language governing permissions and limitations under
14+
* the License.
15+
*/
16+
package org.androidannotations.ebean;
17+
18+
import org.androidannotations.annotations.EBean;
19+
20+
import android.content.Context;
21+
22+
@EBean
23+
public class SomeBeanWithContextAndNoParamsConstructors {
24+
25+
public SomeBeanWithContextAndNoParamsConstructors() {
26+
27+
}
28+
29+
public SomeBeanWithContextAndNoParamsConstructors(Context context) {
30+
31+
}
32+
33+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
/**
2+
* Copyright (C) 2016-2019 the AndroidAnnotations project
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
5+
* use this file except in compliance with the License. You may obtain a copy of
6+
* the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed To in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12+
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13+
* License for the specific language governing permissions and limitations under
14+
* the License.
15+
*/
16+
package org.androidannotations.ebean;
17+
18+
import org.androidannotations.annotations.EBean;
19+
20+
import android.content.Context;
21+
22+
@EBean
23+
public class SomeBeanWithContextParamConstructor {
24+
25+
public SomeBeanWithContextParamConstructor(Context context) {
26+
27+
}
28+
29+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
/**
2+
* Copyright (C) 2016-2019 the AndroidAnnotations project
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
5+
* use this file except in compliance with the License. You may obtain a copy of
6+
* the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed To in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12+
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13+
* License for the specific language governing permissions and limitations under
14+
* the License.
15+
*/
16+
package org.androidannotations.ebean;
17+
18+
import org.androidannotations.annotations.EBean;
19+
20+
@EBean
21+
public class SomeBeanWithEmptyConstructor {
22+
23+
public SomeBeanWithEmptyConstructor() {
24+
25+
}
26+
27+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
/**
2+
* Copyright (C) 2016-2019 the AndroidAnnotations project
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
5+
* use this file except in compliance with the License. You may obtain a copy of
6+
* the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed To in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12+
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13+
* License for the specific language governing permissions and limitations under
14+
* the License.
15+
*/
16+
package org.androidannotations.ebean;
17+
18+
import org.androidannotations.annotations.EBean;
19+
20+
import android.content.Context;
21+
22+
@EBean
23+
public class SomeBeanWithNonContextConstructors {
24+
25+
public SomeBeanWithNonContextConstructors(String someParam) {
26+
27+
}
28+
29+
public SomeBeanWithNonContextConstructors(Context context, int someParam) {
30+
31+
}
32+
33+
public SomeBeanWithNonContextConstructors(String someParam, Context context) {
34+
35+
}
36+
37+
}

0 commit comments

Comments
 (0)