Skip to content

Commit d7a53a1

Browse files
author
albertotn
committed
removed unused import
1 parent c970595 commit d7a53a1

1 file changed

Lines changed: 92 additions & 93 deletions

File tree

Lines changed: 92 additions & 93 deletions
Original file line numberDiff line numberDiff line change
@@ -1,93 +1,92 @@
1-
/*
2-
* Copyright 2015 jmrozanec
3-
* Licensed under the Apache License, Version 2.0 (the "License");
4-
* you may not use this file except in compliance with the License.
5-
* You may obtain a copy of the License at
6-
* http://www.apache.org/licenses/LICENSE-2.0
7-
* Unless required by applicable law or agreed to in writing, software
8-
* distributed under the License is distributed on an "AS IS" BASIS,
9-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10-
* See the License for the specific language governing permissions and
11-
* limitations under the License.
12-
*/
13-
14-
package com.cronutils.model.field;
15-
16-
import com.cronutils.model.definition.CronDefinitionBuilder;
17-
import com.cronutils.model.field.constraint.FieldConstraints;
18-
import com.cronutils.model.field.constraint.FieldConstraintsBuilder;
19-
import com.cronutils.model.field.definition.FieldDefinition;
20-
import com.cronutils.model.field.definition.FieldDefinitionBuilder;
21-
import org.junit.After;
22-
import org.junit.Before;
23-
import org.junit.Ignore;
24-
import org.junit.Test;
25-
import org.junit.runner.RunWith;
26-
import org.mockito.ArgumentCaptor;
27-
import org.mockito.Mock;
28-
import org.mockito.MockitoAnnotations;
29-
import org.powermock.api.mockito.PowerMockito;
30-
import org.powermock.core.classloader.annotations.PrepareForTest;
31-
import org.powermock.modules.junit4.PowerMockRunner;
32-
33-
import static org.junit.Assert.assertEquals;
34-
import static org.mockito.ArgumentMatchers.any;
35-
import static org.mockito.Mockito.*;
36-
37-
@Ignore
38-
@RunWith(PowerMockRunner.class)
39-
@PrepareForTest({ FieldConstraintsBuilder.class, FieldDefinitionBuilder.class })
40-
public class FieldDefinitionBuilderTest {
41-
private CronFieldName testFieldName;
42-
@Mock
43-
private CronDefinitionBuilder mockParserBuilder;
44-
@Mock
45-
private FieldConstraintsBuilder mockConstraintsBuilder;
46-
47-
private FieldDefinitionBuilder fieldDefinitionBuilder;
48-
49-
@Before
50-
public void setUp() {
51-
MockitoAnnotations.openMocks(this);
52-
testFieldName = CronFieldName.SECOND;
53-
54-
when(mockConstraintsBuilder.forField(any(CronFieldName.class))).thenReturn(mockConstraintsBuilder);
55-
PowerMockito.mockStatic(FieldConstraintsBuilder.class);
56-
PowerMockito.when(FieldConstraintsBuilder.instance()).thenReturn(mockConstraintsBuilder);
57-
58-
fieldDefinitionBuilder = new FieldDefinitionBuilder(mockParserBuilder, testFieldName);
59-
}
60-
61-
@Test
62-
public void testWithIntMapping() {
63-
final int source = 7;
64-
final int dest = 0;
65-
66-
fieldDefinitionBuilder.withIntMapping(source, dest);
67-
68-
verify(mockConstraintsBuilder).withIntValueMapping(source, dest);
69-
}
70-
71-
@Test
72-
public void testAnd() {
73-
final FieldConstraints constraints = mock(FieldConstraints.class);
74-
when(mockConstraintsBuilder.createConstraintsInstance()).thenReturn(constraints);
75-
final ArgumentCaptor<FieldDefinition> argument = ArgumentCaptor.forClass(FieldDefinition.class);
76-
77-
fieldDefinitionBuilder.and();
78-
79-
verify(mockParserBuilder).register(argument.capture());
80-
assertEquals(testFieldName, argument.getValue().getFieldName());
81-
verify(mockConstraintsBuilder).createConstraintsInstance();
82-
}
83-
84-
@Test(expected = NullPointerException.class)
85-
public void testConstructorNullParserBuilder() {
86-
new FieldDefinitionBuilder(null, testFieldName);
87-
}
88-
89-
@Test(expected = NullPointerException.class)
90-
public void testConstructorNullTestFieldName() {
91-
new FieldDefinitionBuilder(mockParserBuilder, null);
92-
}
93-
}
1+
/*
2+
* Copyright 2015 jmrozanec
3+
* Licensed under the Apache License, Version 2.0 (the "License");
4+
* you may not use this file except in compliance with the License.
5+
* You may obtain a copy of the License at
6+
* http://www.apache.org/licenses/LICENSE-2.0
7+
* Unless required by applicable law or agreed to in writing, software
8+
* distributed under the License is distributed on an "AS IS" BASIS,
9+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10+
* See the License for the specific language governing permissions and
11+
* limitations under the License.
12+
*/
13+
14+
package com.cronutils.model.field;
15+
16+
import com.cronutils.model.definition.CronDefinitionBuilder;
17+
import com.cronutils.model.field.constraint.FieldConstraints;
18+
import com.cronutils.model.field.constraint.FieldConstraintsBuilder;
19+
import com.cronutils.model.field.definition.FieldDefinition;
20+
import com.cronutils.model.field.definition.FieldDefinitionBuilder;
21+
import org.junit.Before;
22+
import org.junit.Ignore;
23+
import org.junit.Test;
24+
import org.junit.runner.RunWith;
25+
import org.mockito.ArgumentCaptor;
26+
import org.mockito.Mock;
27+
import org.mockito.MockitoAnnotations;
28+
import org.powermock.api.mockito.PowerMockito;
29+
import org.powermock.core.classloader.annotations.PrepareForTest;
30+
import org.powermock.modules.junit4.PowerMockRunner;
31+
32+
import static org.junit.Assert.assertEquals;
33+
import static org.mockito.ArgumentMatchers.any;
34+
import static org.mockito.Mockito.*;
35+
36+
@Ignore
37+
@RunWith(PowerMockRunner.class)
38+
@PrepareForTest({ FieldConstraintsBuilder.class, FieldDefinitionBuilder.class })
39+
public class FieldDefinitionBuilderTest {
40+
private CronFieldName testFieldName;
41+
@Mock
42+
private CronDefinitionBuilder mockParserBuilder;
43+
@Mock
44+
private FieldConstraintsBuilder mockConstraintsBuilder;
45+
46+
private FieldDefinitionBuilder fieldDefinitionBuilder;
47+
48+
@Before
49+
public void setUp() {
50+
MockitoAnnotations.openMocks(this);
51+
testFieldName = CronFieldName.SECOND;
52+
53+
when(mockConstraintsBuilder.forField(any(CronFieldName.class))).thenReturn(mockConstraintsBuilder);
54+
PowerMockito.mockStatic(FieldConstraintsBuilder.class);
55+
PowerMockito.when(FieldConstraintsBuilder.instance()).thenReturn(mockConstraintsBuilder);
56+
57+
fieldDefinitionBuilder = new FieldDefinitionBuilder(mockParserBuilder, testFieldName);
58+
}
59+
60+
@Test
61+
public void testWithIntMapping() {
62+
final int source = 7;
63+
final int dest = 0;
64+
65+
fieldDefinitionBuilder.withIntMapping(source, dest);
66+
67+
verify(mockConstraintsBuilder).withIntValueMapping(source, dest);
68+
}
69+
70+
@Test
71+
public void testAnd() {
72+
final FieldConstraints constraints = mock(FieldConstraints.class);
73+
when(mockConstraintsBuilder.createConstraintsInstance()).thenReturn(constraints);
74+
final ArgumentCaptor<FieldDefinition> argument = ArgumentCaptor.forClass(FieldDefinition.class);
75+
76+
fieldDefinitionBuilder.and();
77+
78+
verify(mockParserBuilder).register(argument.capture());
79+
assertEquals(testFieldName, argument.getValue().getFieldName());
80+
verify(mockConstraintsBuilder).createConstraintsInstance();
81+
}
82+
83+
@Test(expected = NullPointerException.class)
84+
public void testConstructorNullParserBuilder() {
85+
new FieldDefinitionBuilder(null, testFieldName);
86+
}
87+
88+
@Test(expected = NullPointerException.class)
89+
public void testConstructorNullTestFieldName() {
90+
new FieldDefinitionBuilder(mockParserBuilder, null);
91+
}
92+
}

0 commit comments

Comments
 (0)